On 8/11/06, Madduri, Murthy <[EMAIL PROTECTED]> wrote:
Well, the question I have is how can we have this level config which is not in the regular list of levels? I mean the "config" level messages here are those messages that are related to one flow of Configuration activity. This may include classes ( hierarchies) from com.xxx.config.init, com.xxx.util, com.xxx.services etc. My logger definition can be very much like com.xxx so that it picks out ALL the messages from com.xxx and below. BUT, it should pick messages with level CONFIG only.
I am not suggesting that new levels be added. Instead of a config level, it would work much better to have a config logger hierarchy. You then send all logs from the config logger hierarchy to a config appender, all logs from the normal ("com") logger hierarchy to the normal appender, all logs from the security logger higherarchy to the security appender, etc.
I have verified in the current logging levels, If I define the logger with level WARN, it is logging all the messages WARN and lower. Though, I try to log ERROR,it would not pick the message since ERROR > WARN. This way, I can group all WARN and Lower levels to a separate log file. Similarly, I wanted to have CONFIG, SECURITY, BUSINESSACTIVITY, PERFORMANCE custom log levels in the same level below DEBUG.
Do you want debug, info, etc messages to go to the config appender or do you plan to add a log level filter to prevent anything higher than config?
> > <logger name="com.xxx"> > > > > <!-- Logging level (i.e. WARN) for this logger: --> > > <level value="CONFIG" /> > > > > <!-- File appender for this logger: --> > > <appender-ref ref="fileAppender" /> > > </logger> > > <logger name="com.xxx"> > > > > <!-- Logging level (i.e. WARN) for this logger: --> > > <level value="SECURITY" /> > > > > <!-- File appender for this logger: --> > > <appender-ref ref="securefileAppender" /> > > </logger> -----Original Message----- From: James Stauffer [mailto:[EMAIL PROTECTED] Sent: Friday, August 11, 2006 12:51 PM To: Log4J Users List Subject: Re: Different Log4j log file(s) based on Logging Level? If you want an appender to only have config level messages and no other level of messages then you don't really want a new level. Levels are all about cascading priorities and if you don't want that then a new logger hierarchy is actually much better. To add a new level takes some new classes and a bit of work (not sure how much because I haven't looking into it) but doing another logger hierarchy doesn't require any unusual changes. On 8/11/06, Madduri, Murthy <[EMAIL PROTECTED]> wrote: > > <logger name="com.logging.test"> > > > > <!-- Logging level (i.e. WARN) for this logger: --> > > <level value="CONFIG" /> > > > > <!-- File appender for this logger: --> > > <appender-ref ref="fileAppender" /> > > </logger> > > The appender mentioned in the above example is an appender that writes to a separate log file (ex, myapp-config.log) file. But, my question is how can I define a custom Level CONFIG and make it lower than DEBUG? How can I do this in the solution mentioned below: > >>> First,create a level CONFIG. > >>>make config lower priority than DEBUG, > >>> add filters to accept only config messages in that appender > > > -----Original Message----- > From: Javier Gonzalez [mailto:[EMAIL PROTECTED] > Sent: Friday, August 11, 2006 12:33 PM > To: Log4J Users List > Subject: Re: Different Log4j log file(s) based on Logging Level? > > On 8/11/06, Madduri, Murthy <[EMAIL PROTECTED]> wrote: > > We have hierarchical logging in our applications. > > But, this requirement is to have the logs grouped based on a custom > > level. > > For a typical configuration transaction, the logger can record messages > > from various hierarchies. We are not guaranteed of the sequence of > > messages in this whole transaction. We are pretty much getting all the > > messages, but, they ended up mixing with other trace statements. > > > > For example, if we have a new custom log level, can we use that in > > <logger> configuration like this? > > <logger name="com.logging.test"> > > > > <!-- Logging level (i.e. WARN) for this logger: --> > > <level value="CONFIG" /> > > > > <!-- File appender for this logger: --> > > <appender-ref ref="fileAppender" /> > > </logger> > > You could, but that (I think) would mean you get all the messages of > level config and above, unless you make config higher than fatal. > > What you could do is have an appender that is dedicated to these > config messages, make config lower priority than DEBUG, add filters to > accept only config messages in that appender, and then set the > threshold of the other loggers above config. (root logger set at > config level) That way, the "normal" appenders don't log config, and > the config appender logs only config. > > -- > Javier González Nicolini > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- James Stauffer Are you good? Take the test at http://www.livingwaters.com/good/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- James Stauffer Are you good? Take the test at http://www.livingwaters.com/good/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]