Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Logging in to 2 separate Log Files ?

 
Navin Pillu
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I've question regarding Log. I want two separate log files & want to write in that choosing a file runtime.

I wrote log4jCongig.xml like



So how can i write code to choose runtime log file?

Thanks in Advance
[ May 30, 2005: Message edited by: Navin Pillu ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Navin,

Since log4j is used in all kinds of Java apps and since this forum is devoted to Servlets, you may have better luck with this question in the "Other APIs" forum.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved the "Other APIs" as rquested

Dave
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should create your own log appender that keeps track of all log messages. At runtime you can set the target files of that appender to anything you want.

So just write a class that follows the required Log4J interfaces. Let it collect all log messages. Create a setter upon it that allows you to set the target file at runtime. Maybe you can even let it extends from the LogAppender that you refer to in the above example.

I don't know which interfaces you have to extend exactly, but I bet you can find it in the Loggers documentation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!