You can setup 5 appenders on the root logger and then use a LevelMatchFilter on each appender to get only one level.
I find that it is useful to have appenders that include a level and all higher levels. i.e. Debug appender will have all logs, info will have info and higher, etc. To do that just set a threshold on each appender. info would have a threshold of info, warn would have a threshold of warn, etc. This has the advantage of being able to look at the debug lines around an error. On 12/20/05, Philip Denno <[EMAIL PROTECTED]> wrote: > Are you are asking how to send different level messages to different > files using one logger? > > If this is the case then I think the answer is that it is not possible. > > If you really need to separate the level messages then you would need to > use different loggers for each level. > > Can I ask what the rational behind this separation is? If you want to be > able to locate errors quickly you should consider using some filtering > tool such as Chainsaw, or if errors need to be handled quickly, try > configuring an SMTPAppender to ERROR. > > Cheers, > Philip. > > -----Original Message----- > From: Sravan Duggaraju [mailto:[EMAIL PROTECTED] > Sent: December 20, 2005 1:52 PM > To: [email protected] > Subject: Re: Log4j Messages into different files based on diffent Levels > > > I have gone through the document and tried to implement it...but the > messages are showing in all files. > > My requrement is information related messages should go to AuditLog and > Error messages should go to ErrorLog. > > i was setting the messages like > logger.info("this is info message"); > logger.error("this is error message"); > > > > > On 12/20/05, Sravan Duggaraju <[EMAIL PROTECTED]> wrote: > > > > Hi, > > Using log4j can we log different level msgs (like DEBUG,ERROR,INFO > > etc) in separate file appenders? For example, all the 'INFO' messages > > go to AuditLog. 'ERROR' messages would go to ErrorLog .. > > Please let me know if any option is avaialble to perform this. > > > > I appreciate if you can send the properties/xml file and how you > > accessed it form the application. > > > > Thanks > > Sandi > > > > --------------------------------------------------------------------- > 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]
