Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-31-2007, 02:29 PM
Member
 
Join Date: Jul 2007
Posts: 9
arfatkhan is on a distinguished road
log4j initialization
Hi Everybody,

I want to use log4j in my application. I downloaded the required jar file, now I want to initialize it.Please help me, how to initialize log4j.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-01-2007, 06:31 AM
Member
 
Join Date: Jul 2007
Posts: 51
mary is on a distinguished road
I give you an example
Code:
package com.foo; import org.apache.log4j.PropertyConfigurator; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; import java.io.IOException; public class Log4jInit extends HttpServlet { public void init() { String prefix = getServletContext().getRealPath("/"); String file = getInitParameter("log4j-init-file"); // if the log4j-init-file is not set, then no point in trying if(file != null) { PropertyConfigurator.configure(prefix+file); } } public void doGet(HttpServletRequest req, HttpServletResponse res) { }
if you want more details you can check the documentation of the log4j project
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-01-2007, 12:25 PM
Member
 
Join Date: Jul 2007
Posts: 9
arfatkhan is on a distinguished road
Hi ,

I am using weblogic server.As I mentioned I downloaded the required log4j.jar. When I am runing my application, on the server console I am getting this warning.

log4j:WARN No appenders could be found for logger (org.apache.commons.digester.D
igester).
log4j:WARN Please initialize the log4j system properly.

Please help me to overcome this problem.

Thanks
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-10-2007, 08:42 PM
Member
 
Join Date: Jul 2007
Posts: 44
simon is on a distinguished road
This means that the log4j.properties file that you have created in NOT in
the classpath. Make it available in the classpath.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Initialization and re-assignment of arrays Java Tip java.lang 0 04-14-2008 09:38 PM
How to use Initialization callbacks in Spring Framework Java Tip Java Tips 0 03-31-2008 11:16 AM
initialization value problem ravian New To Java 2 01-28-2008 11:54 AM
Icon initialization problem saz25 AWT / Swing 1 12-24-2007 11:37 PM
Lazy Initialization onegcr New To Java 1 08-14-2007 04:29 PM


All times are GMT +3. The time now is 05:20 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org