RE: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
If I understand you correctly, you want to have several loggers all using the same appender? Use the hierarchical approach of the logger repository by prefixing your logger names: more loggers for family2 Like this all loggers of loggerFamily1 write to the appender MultiplexingAppender1, but on different log-levels, and all loggers of loggerFamily2 write to appender MultiplexingAppender2. Heri -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Thursday, April 08, 2010 9:55 AM To: log4j-user@logging.apache.org Subject: [SCL-2] Re: Multiple log files, multiple logger names and the same appender Hopefully more explanation can attract some ideas here. I am using XML configuration and a custom appender. So I have one section in the XML corresponding to one logger name and one log file. So for each different logger name, log file and the same custom appender I need to add one more section in log4j.xml Is there a way to parameterize the logger section and the log file so that one section can substitute for multiple sections ? The same appender is used for all sections. -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p28175329.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
Thanks. The log files are also different for each logger but the log file configuration is inside the appender configuration ! -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p28179638.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
This does not seem to be possible unless I use code ? I understand the logger hierarchy. -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p28251807.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
Hope to revive this thread. Is there any way to use the feature I have described. 1. Use the logger hierarchy like Heri had suggested. 2. Use a separate logger file for each logger in the hierarchy. Thanks, Mohan -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p29960730.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
I think for what you want (separate file/logger), you'll need to write a custom appender unless Bender Heri's suggestion suffices for you. Jake On 10/14/2010 3:30 AM, Mohan.Radhakrishnan wrote: > > Hope to revive this thread. Is there any way to use the feature I have > described. > > 1. Use the logger hierarchy like Heri had suggested. > 2. Use a separate logger file for each logger in the hierarchy. > > Thanks, > Mohan - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
Ok. Will try. I think you mean that in order to associate a file name with each logger in the hierarchy instead of the appender I need to write a custom appender. Am I on the right track then ? -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p29968873.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
My initial idea is to pass multiple file names in the XML in the appender section and maintain a list in the custome appender Java code and then based on the logger name or some other parameter pick the correct file name. Performance is one of our major concerns. -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p29971726.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
If you have a limited set of loggers you are concerned with, just create a separate appender for each file you want created. So, if you have 5 loggers you care about, just create 5 appenders; each with its own file. Then associate the appropriate appender with the appropriate logger. In that case, there's no need to create a custom appender. Jake On 10/15/2010 7:46 AM, Mohan.Radhakrishnan wrote: > > My initial idea is to pass multiple file names in the XML in the appender > section and maintain a list in the custom appender Java code and then based > on the logger name or some other parameter pick the correct file name. > Performance is one of our major concerns. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
Jacob, What you are suggesting can be done using the XML itself ? I think this new appender is required due to the limitation in associating an individual logger with its own file. Thanks, Mohan -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p29988016.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-2] Re: Multiple log files, multiple logger names and the same appender
Depends how many "individual loggers" you are concerned with. If there are, say, 3 named loggers, then just create 3 appenders; one for each logger. However, if the number of logger names cannot be known at build time, then you will probably need a custom appender that you assign to some base logger name. For each logger that sends info to the appender, the appender can evaluate whether to write it to an existing log file or create a new one. Jake On Mon, 18 Oct 2010 00:34:42 -0700 (PDT) "Mohan.Radhakrishnan" wrote: Jacob, What you are suggesting can be done using the XML itself ? I think this new appender is required due to the limitation in associating an individual logger with its own file. Thanks, Mohan -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p29988016.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org