logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: R: File Appender help
Date Wed, 08 Dec 2004 05:29:30 GMT
At 09:41 AM 12/7/2004 +0100, you wrote:
 >
 >
 >>Why do you want to create a separate log file for each class?  Or do you
 >>mean that all basic classes log to one file, all servlets log to another
 >>file, and all JSP's log to another file?  That could be achieved if your
 >>logger naming scheme allows you to distinguish between these various
 >>contexts.
 >
 >
 >I need to do that, because i wish to monitoring all events in my java class.
 >(Exception, user information and so on..).
 >

The idea is to have named loggers that all log to one or more 
appenders.  Not a single logger to a single appender.  Imagine if you had 
2000 classes.  You really want 2000 separate appenders?  I'm not sure how 
familiar you are with Log4j logging concepts, but it might be of benefit to 
read the Log4j short manual on the Log4j website.  What I am describing in 
no way precludes you from logging all events in any (and all) of your 
classes.  I'm not sure where you got this idea, but hopefully a bit of 
reading will show you the way.

 >
 >>On the chance that you simply mean not hard coding the file name in the
 >>properties, file, here's how you reference a system property...
 >
 >>log4j.appender.FileLogger.File=${my_servlet_log_file_location}/Servlet.log
 >
 >
 >I tried that, but I have an error when i add one more servlet (or library
 >class) in my context without
 >created before a new /path_new_servlet/Servle.log file.
 >Does Log4j create dynamic  a new Appender file if it not exist in the file
 >system?
 >

What error are you talking about here?  Again, I think you are confused on 
the relationship of loggers and appenders.  You set up a few appenders and 
log to them.  You generally don't dynamically create appenders.  However, 
it is perfectly doable via the Log4j API.  There are some web-based logging 
configuration applications that make this easy to do from a web 
browser.  However, I still think you need to read the Log4j short manual 
first to get a better understanding of Log4j's concepts.


Jake

 >Thanks
 >
 >Francesco.
 >
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
 >For additional commands, e-mail: log4j-user-help@logging.apache.org
 >
 >
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
 >For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message