RE: Log Utility

2008-04-04 Thread Gary Gregory
Also note that log.debug(new String("test")) is the same as log.debug("test"); and in general: new String("test") is the same as "test" Gary > -Original Message- > From: Robert Pepersack [mailto:[EMAIL PROTECTED] > Sent: Friday, April 04, 2008 1:44 PM > To: Log4J Users List > Subje

Anyway to manually flush the buffer content to the log file?

2008-04-04 Thread Matthew Kwong
Hi, I have been search through the forum and google already but I can't find the answer. Right now, I am using RollingFileAppender and set BufferedIO to be true. When my application starts, it will output some startup message (like startup env variable and startup time) to the buffer. However, I

Re: Log Utility

2008-04-04 Thread Robert Pepersack
The Logger.isDebugEnabled() method applies to all of the classes that use your configured log4j repository. If you have your all of your loggers set to DEBUG, then Logger.isDebugEnabled() will return true, no matter what class it gets called in. Robert Pepersack Senior Lead Developer Maryland

Re: Log Utility

2008-04-04 Thread Tim Nguyen
Thank you! It is similar to what I wanted to do. This is more like the solution for one class. Is there anyway to check for all classes? I have hundreds of classes and I want to have an util that I can just replace the current logging (e.g: logger.debug("String")) with LogUtil (e.g: LogUtil.deb

Re: Log Utility

2008-04-04 Thread Robert Pepersack
Hi Tim, The Logger class has a way of checking the level first. First put this in your instance variables: private static final Logger logger = Logger.getLogger("my.package.MyClass"); private final boolean debug = logger.isDebugEnabled(); Then put this in your method: if (this

Log Utility

2008-04-04 Thread Tim Nguyen
Hi, I am writing a Log Utility to check the log level first before creating a string object. For example, if my log level is INFO, and I call: log.debug(new String("test")); It will still instantiate the String object even thought it doesn't log anything. So I would like to write an Utility t

Different Loggers for Different Instances of Same Class

2008-04-04 Thread Robert Pepersack
Hello. Thanks in advance for your help. I'm running scheduled jobs, and they create their own instances of my JDBC class. For example, JobA creates a new JdbcFacadeA, and JobB creates its own JdbcFacadeB. I would like to log each job in its own log (easy). But, I want the output from JdbcFa