Re: [SCL-4] Intercepting LoggingEvent
@Heri Do you think this could affect performance ? @Scott It looks like this is not part of 1.2.16 or extras. Git has the code though. -- View this message in context: http://old.nabble.com/Intercepting-LoggingEvent-tp30302884p30308920.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
Intercepting LoggingEvent
I am trying to intercept the LoggingEvent which is an instance of a custom LoggingEvent created by a library. I have a custom appender and also a filter but neither seems to be a clean way of extracting specific custom information for logging. I think there should be a way to log only what I want from the LoggingEvent by extracting it before the log is written. Is this feasible ? -- View this message in context: http://old.nabble.com/Intercepting-LoggingEvent-tp30302884p30302884.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: Extending Logger
I think I have done what was suggested but there is a catch. I decided to go for a parallel log4j repository for more manageability but retained the log4j Logger. I didn't extend it or wrap it. ( e.g ) JBoss uses its own repository to take care of multiple web applications. The problem is that since I am adding the appenders to log4j's Logger and storing it in my own repository there is duplication. All the loggers and appenders are in both repositories. I don't think there is will be a serious performance issue because all the loggers are accessed from my repository only but I want to disable log4j's repository but still use log4j's logger. Does this make sense ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30199446.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: Extending Logger
Yes. I am responding to your suggestion. The setup performance is not very important. The runtime performance though is. If I setup everything programmatically log4j.xml is not at all needed ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113852.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: Extending Logger
So this is what I understand. If I have too many appender sections in the XML then one appender for a logger is created by log4j. Instead of that I can have one appender and a custom logger for each log file. Both could be equivalent as far as performance is concerned. Am I right ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113734.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: Extending Logger
I wanted to associate the logger file with each Logger instead of the Appender. I have a setFile/getFile in the Logger that I plan to call using my custom Appender so that the log message is written to the file associated with the Logger. Reasons : 1. We have two many appender sections in the XML because there are too many log files. 2. I want to use my custom logger/appender and another xml file - not log4j.xml - to associate a logger with a file. I am trying to parse and read the file name from my custom XML file and set it in my custom logger that log4j's repository has. -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113301.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: Extending Logger
I don't have a way to put my custom logger in the log4j repository so that it is used in place of the log4j Logger. -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p3044.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: Extending Logger
I have wrapped log4j's Logger in a 'custom' logger. The custom logger is my logger. The FQCN of my logger is set in the 'logger' element in the XML. I have an extra parameter to set in my logger that is not in Log4j's logger. So I think that I have to configure this when log4j calls void selectAndConfigure(URL url, String clazz, LoggerRepository hierarchy) { -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30086102.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: Extending Logger
Since extension of Logger is discouraged I wrap it. I think the configuration can be set like this. Thanks, Mohan -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30085722.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: Extending Logger
Solved this. Is there a way to get my custom logger that log4J has configured and set some values using reflection ? The API does not seem to return the correct type. It returns Logger always and not CustomLogger. -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30085289.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
Extending Logger
The complete Log4J manual discourages us from extending Logger but we use the recommended pattern then 'repository' and 'getEffectiveLevel()' are inaccessible because they are protected in Category. public void trace(Object message) { if (repository.isDisabled(Level.TRACE_INT)) { return; } if (Level.TRACE.isGreaterOrEqual(this.getEffectiveLevel())) { forcedLog(FQCN, Level.TRACE, message, null); } } Can we extend Logger ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30018462.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
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
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: Loggers share an Appender instance?
Hi Shef, Looks like your question is like mine ( http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-td28024737.html ). My appender is only one by I want a logger specific file. The recommendation is a custom appender. Thanks, Mohan -- View this message in context: http://old.nabble.com/Loggers-share-an-Appender-instance--tp29741792p29969699.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
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
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
Log as a template for a report
Hi, We are writing several logs as text files. This is used by the ops. teams but we also want the capability to convert the logs files to reports. These reports could be HTML or PDF and the FreeMarker templating engine can achieve this. So there could be two types of log formats for each log. One is a text file and the other could be XML so that FreeMarker can transform it into HTML or PDF. I have two questions. 1. What is the kind of load added when each log is written in two formats ? I know this involves load testing. 2. Is there a facility in log4j that allows plug points for FreeMarker etc. ? What is the general approach followed to show logs as reports ? Thanks, Mohan -- View this message in context: http://old.nabble.com/Log-as-a-template-for-a-report-tp29085824p29085824.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
Regex as filter param value
I need a filter that uses regex in log4j.xml. The XML validation complains. CDATA is understood by log4j ? param name="Expression" value="^[]+)>(.+?)" -- View this message in context: http://old.nabble.com/Regex-as-filter-param-value-tp28267219p28267219.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: RollingFileAppender not working consistently
1. I had to copy the newer DTD from the Apache extras JAR to the log4j JAR. 'rollingPolicy' was not recognized by the older DTD. Is this right ? 2. Put both JARS in the classpath. This warning is shown though. log4j:WARN Continuable parsing error 182 and column 23 log4j:WARN The content of element type "log4j:configuration" must match "(renderer*,appender*,plugin*,(category|logger)*,root?,(categoryFactory|loggerFactory)?)". Activating options Activating options -- View this message in context: http://old.nabble.com/RollingFileAppender-not-working-consistently-tp28087307p28219427.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: RollingFileAppender not working consistently
This seems to be working now. There is no need for renaming a file unless I am missing something ! I get one timestamped file for a day. Now the next step could to combine with a SizeBasedTriggeringPolicy Mohan.Radhakrishnan wrote: > > TimeBasedRollingPolicy seems to be the solution. Correct me if I am wrong. > > Extract from the doc. > > During November 23rd, 2004, logging output will go to > * the file /wombat/foo.2004-11-23. At midnight and for > * the rest of the 24th, logging output will be directed to > * /wombat/foo.2004-11-24 > -- View this message in context: http://old.nabble.com/RollingFileAppender-not-working-consistently-tp28087307p28216608.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: RollingFileAppender not working consistently
TimeBasedRollingPolicy seems to be the solution. Correct me if I am wrong. Extract from the doc. During November 23rd, 2004, logging output will go to * the file /wombat/foo.2004-11-23. At midnight and for * the rest of the 24th, logging output will be directed to * /wombat/foo.2004-11-24 -- View this message in context: http://old.nabble.com/RollingFileAppender-not-working-consistently-tp28087307p28215329.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: RollingFileAppender not working consistently
I have looked at the source here and I have a question. Since the log4j extras has other methods of rolling over that are time based I thought if we schedule the rename for a lean period when there is not much log file updates then there would be no problem. Am I on the right track ? What about appenders that don't roll over but create a file the first time with a timestamp ? Does this solve the roll over issue ? -- View this message in context: http://old.nabble.com/RollingFileAppender-not-working-consistently-tp28087307p28187724.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
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: 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
RE: RollingFileAppender not working consistently
Don't mean to hijack this thread. We have a pressing need to move to DailyRollingFileAppender due to the same problems mentioned in this thread. Since midnight is not suitable due to heavy logging we want to use DailyRollingFileAppender at midday or some other time. Is that possible ? I refer http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html -- View this message in context: http://old.nabble.com/RollingFileAppender-not-working-consistently-tp28087307p28147954.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: RollingFileAppender not working consistently
We see the same problem. Sometimes several successive attempts to rename fail. Actually we also have multithreaded application and we think that one of the threads could be writing when the file is being renamed. We are thinking of using the DailyRollingAppender. Is that an alternative ? -- View this message in context: http://old.nabble.com/RollingFileAppender-not-working-consistently-tp28087307p28139063.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
Multiple log files, multiple logger names and the same appender
Hi, I have been able to channelize the log information by writing a custom appender and specifying the logger name as 'Test1' into a separate log file. How can I use multiple log files, multiple logger names and the same appender ? In short I would like to avoid repeating the same XML section for the same appender but different log files and logger names. Hope the question is clear. We require many logger names and multiple log files. Thanks, Mohan -- View this message in context: http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-tp28024737p28024737.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