File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Log4j help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4j help" Watch "Log4j help" New topic

Log4j help

gurudev jai

Joined: Oct 21, 2004
Posts: 2

Any body help me

i am developing Framework for my project.My requirement is logging and Audting.My doubt:is it possible to sent some log messages to database and some log messages to file using same properties file
Can anybody help me how to is helpful to sent code for that.



Pavan Panduga
Ranch Hand

Joined: Jun 12, 2002
Posts: 68

Yes, it is possible to send log messages to more than one destination. You have to configure appropriate Appenders in the log4j configuration file and you'll be all set.

In the Log4J distribution there's an example to show multiple destination configurations, It is configured to send messages to a File and GUI at the same time. So you may want to look for examples to look for JDBCAppenders.

Hope this helps,
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
If you want to get serious with log4j get the complete log4j manual

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
I agree. Here's the link:
subject: Log4j help
It's not a secret anymore!