logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Moore <jim.mo...@veritas.com>
Subject RE: Turn off logging, and getHeader()/getFooter() in layout class
Date Fri, 02 Mar 2001 02:16:12 GMT
In the last beta announcement Ceki said that he's going to be away from
email for a couple of weeks, so you'll have to deal with just us mere
mortals 'til then...

1) There's a number of options.  But the easiest is that if you don't log
anything with a priority of FATAL, then setting the root category to have a
threshold of FATAL will effectively turn off all logging.  (Assuming you
don't override the root category's threshold anywhere, of course.)

2) I think I remember seeing that there's a bug in using that feature in
1.04.  It appears to be fixed in the 1.1beta.  If you want to keep with the
1.04 codebase for now, you can override the appender to simply make sure you
write out the header after setting the writer/file, and write out the footer
yourself before closing the file.  (The setFile(..) and close() methods, I

-Jim Moore

-----Original Message-----
From: jebe002@um.edu.mt [mailto:jebe002@um.edu.mt]
Sent: Thursday, March 01, 2001 11:49 AM
To: log4j-user@jakarta.apache.org
Subject: Turn off logging, and getHeader()/getFooter() in layout class

Hi all, and good evening ceki (you will probably be the only one to answer 

I am using log4j and it meets almost all my requirements.  However I have

(1) How do I turn all logging off from the CONFIG file ?  What do I need to
?  If the user does not want to log anything how should he configure the
file ?  

(2) I have created my own layout class (to output in xml) and I would like
set an appropriate xml header (I subclasses layout and overridden the 
getHeader() method)

public String getHeader() {
    StringBuffer buf = new StringBuffer();
    buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    return buf.toString();

while everything in the layout is ok, this header never appears anywhere in
log file.  The same can be said if you try to set a footer.  Why ?  (I am

ANy Ideas Please anyone ? 


View raw message