• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding Loggers  RSS feed

 
rajanikanth bhagavan kanth
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a small requirement.I want to log my exceptions and debug messages in log file.But the only thing is i want to log all my exceptions in one log file and all other things like debug and info messages in another file.Is it possible by using logger framework?
Iam able to log all the messages in single file only.

If i posted in wrong forum please excuse me and move to appropriate forum.

Regards,
Bhagavan
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could reassign the System.err PrintStream with your own PrintStream that writes to a file. This way, whenever printStackTrace() is invoked, instead of writing to the console it writes to the file.

Same applies for your regular logger. You could reassign the System.out PrintStream with your own and then just log with System.out.println();

This is the easiest approach of a Logger.
 
rajanikanth bhagavan kanth
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Sebastian Janisch.It helped me lot
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!