RE: Integrating LOG4J into Orion...
Well I've followed all these instructions but have fallen over on a couple of counts: 1- Using a BasicConfigurator, which is initialised within a singleton, nothing is displayed, it's as if log4j has gobbled up all my messages :-( 2- If I try and use a DOMConfigurator it can't find the config file. Help anyone? Thanks, Guy :-( -Original Message- From: Scott Farquhar [mailto:[EMAIL PROTECTED]] Sent: 22 January 2002 01:28 To: Orion-Interest Subject: Re: Integrating LOG4J into Orion... Further to what Mike has said, I'll just give you a little update on the status of the Log4j 1.2 release. The 1.2 code base is largely different to the 1.1 base, and has features that when finished, will be useful for using in application servers, and make it a lot easier to configure. The features that I talk about are: - Different LogManagers. This will allow Orion to provide a logmanager *per application*, or if it can't find one, use the default logmanager. This means that you will be able to specify a configuration file per application, and not have to manually configure it. - Configuration files will be reloaded The watchers code is being rewritten. When it is finished, you will most likely have code that allows you to configure how often the config files are reloaded (and stop / restart the watcher thread). So what does this mean for you, if you are using log4j in your application now? - Use the 1.2 code. Although in alpha, it is quite stable. - If you have specific requirements (apart from the above two), suggest them on the log4j email list, or email me with your suggestions. Lastly - congratulations on using log4j. Logging is very important in enterprise applications! Cheers, Scott -- Scott Farquhar :: [EMAIL PROTECTED] Atlassian :: http://www.atlassian.com Supporting YOUR J2EE World Mike Cannon-Brookes wrote: This is one possible scenario - but as Jeff says it's server specific logging (not application specific) - which can often be non-optimal. We have a document coming out on this (check http://kb.atlassian.com) soon, but until it's finished here's what we usually do: - use the latest log4j from CVS (which has the capability to define which is the default log loading class - there is now one which loads log4j.xml from classpath, and watches it) - I believe it's done via system properties (selecting automated file loader and watch time) - add a library path=config / to your orion-application.xml for each application - add config/log4j.xml to your application You're done! this means you now have : - automatic log configuration (no more need for servlet listeners, application clients or servlets to configure logging!) - dynamic logging (you can just change the log4j.xml file and your changes are picked up without redeployment) - logging _per application_ (rather than per server) As I said, see if the above directions work for you and please email me off list if they don't (so we can adjust the document in progress). Watch this space for the doco coming soon ;) Hope this helps! Mike Mike Cannon-Brookes [EMAIL PROTECTED] Atlassian :: www.atlassian.com Supporting YOUR world Now just configure log4j.xml On 19/1/02 4:40 AM, Jeff Schnitzer ([EMAIL PROTECTED]) penned the words: I put the log4j.jar in orion's lib directory, and use -Dlog4j.configuration=file:path/to/log4j.properties to initialize log4j. I'm pretty happy with this approach. I control logging on a server-wide basis, so I can use the same ear file for both testing and deployment. Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 5:35 PM To: Orion-Interest Subject: FW: Integrating LOG4J into Orion... One more time, the last one did not show up -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 11:09 AM To: Orion-Interest Subject: Integrating LOG4J into Orion... I have a full EJB/JSP application running with Orion. Is there a preferred method of initializing LOG4J in this situation? Looking at the LOG4J documentation, they mention using a startup servlet to do the initialization. I am concerned as to how this would work with the CLASSLOADER hierarchy. If I initialize my LOG4J at the servlet (WEB) layer, will the EJB's be able to see the initialized LOG4J or will they attempt to re-initialize due to the different classloader? Thanks. -AP_
Re[2]: Integrating LOG4J into Orion...
Hallo Guy, we have developed a servlet which is loaded at the startup of orion (via the load-on-startup1/load-on-startup in the servlet-definition in web.xml) and initialises the log4j-framework according to a properties-file. This will set up the loging-configuration globally, though... greetings Rob -SOURCE AHEAD- package com.scaraboo.logging; import javax.servlet.http.*; import org.apache.log4j.*; /** * Title:Log4jInitServlet initializes log4j-logging for JSP. * Description: This servlet should be loaded at startup, definition in * /WEB-INF/web.xml: * pre *lt;?xml version=1.0?gt; *lt;!DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtdgt; * *lt;web-appgt; * lt;servletgt; *lt;servlet-namegt;log4j-initlt;/servlet-namegt; *lt;servlet-classgt;com.scaraboo.logging.Log4jInitServletlt;/servlet-classgt; *lt;init-paramgt; * lt;param-namegt;cfg_filelt;/param-namegt; * lt;param-valuegt;logging.cfglt;/param-valuegt; *lt;/init-paramgt; *lt;load-on-startupgt;1lt;/load-on-startupgt; * lt;/servletgt; *lt;/web-appgt; * /pre * Copyright:Copyright (c) 2001 * Company: scaraboo GmbH * @author Robert Virkus, [EMAIL PROTECTED] * @version 1.0 * @see a href=http://jakarta.apache.org/log4j/docs/documentation.html;http://jakarta.apache.org/log4j/a */ public class Log4jInitServlet extends HttpServlet { private static Category LOG = Category.getInstance( Log4jInitServlet.class.getName() ); public void init() { String cfgpath = logging.cfg; if (getInitParameter( cfg_file ) != null) cfgpath = getInitParameter( cfg_file ); PropertyConfigurator.configure( cfgpath ); LOG.info(logging configuration is set according to configuration-file [ + cfgpath + ]. ); } public void doGet( HttpServletRequest req, HttpServletResponse resp ) { // do nothing, servlet should just be loaded at startup } } Thursday, January 31, 2002, 7:15:09 PM, you wrote: DGTL Well I've followed all these instructions but have fallen over on a couple DGTL of counts: DGTL 1- Using a BasicConfigurator, which is initialised within a singleton, DGTL nothing is displayed, it's as if log4j has gobbled up all my messages :-( DGTL 2- If I try and use a DOMConfigurator it can't find the config file. DGTL Help anyone? DGTL Thanks, DGTL Guy :-( DGTL -Original Message- DGTL From: Scott Farquhar [mailto:[EMAIL PROTECTED]] DGTL Sent: 22 January 2002 01:28 DGTL To: Orion-Interest DGTL Subject: Re: Integrating LOG4J into Orion... DGTL Further to what Mike has said, I'll just give you a little update on the DGTL status of the Log4j 1.2 release. DGTL The 1.2 code base is largely different to the 1.1 base, and has features DGTL that when finished, will be useful for using in application servers, and DGTL make it a lot easier to configure. DGTL The features that I talk about are: DGTL - Different LogManagers. DGTL This will allow Orion to provide a logmanager *per application*, or if DGTL it can't find one, use the default logmanager. This means that you will DGTL be able to specify a configuration file per application, and not have to DGTL manually configure it. DGTL - Configuration files will be reloaded DGTL The watchers code is being rewritten. When it is finished, you will DGTL most likely have code that allows you to configure how often the config DGTL files are reloaded (and stop / restart the watcher thread). DGTL So what does this mean for you, if you are using log4j in your DGTL application now? DGTL - Use the 1.2 code. Although in alpha, it is quite stable. DGTL - If you have specific requirements (apart from the above two), suggest DGTL them on the log4j email list, or email me with your suggestions. DGTL Lastly - congratulations on using log4j. Logging is very important in DGTL enterprise applications! DGTL Cheers, DGTL Scott Mit freundlichen Grüßen, Robert Virkus Director Mobile Solutions -- Robert Virkus scaraboo GmbH mobile Entertainment Georg-Wulf-Str.4-6 28199 Bremen Germany phone +49 - (0)421 - 59 67 549 fax+49 - (0)421 - 59 67 567 mobile +49 - (0)171 - 35 31 635 [EMAIL PROTECTED] www.scaraboo.de wap.scaraboo.de Aus Rechts- und Sicherheitsgruenden ist die in dieser E-Mail gegebene Information nicht rechtsverbindlich. Eine rechtsverbindliche Bestaetigung reichen wir Ihnen gerne auf Anforderung in schriftlicher Form nach. Beachten Sie bitte, dass jede Form der unautorisierten Nutzung, Veroeffentlichung, Vervielfaeltigung oder Weitergabe des Inhalts dieser E-Mail nicht gestattet ist. Diese Nachricht ist ausschliesslich fuer den bezeichneten Adressaten oder dessen Vertreter bestimmt. Sollten Sie nicht der vorgesehene
RE: Integrating LOG4J into Orion...
It probably depends on how you have it configured. The main thing to remember is that J2EE uses multiple classloaders and each classloader can potentially have it's own version of a singleton. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Justin Crosbie Sent: Monday, 21 January, 2002 8:13 PM To: Orion-Interest Subject: RE: Integrating LOG4J into Orion... Hi, We have wrapped Log4J in a singleton, so the first call to it initialises it. I'm not sure if this is a good idea or not though, but we've had no problems so far. Any opinions? -Justin -Original Message- From: Romen Law [mailto:[EMAIL PROTECTED]] Sent: 20 January 2002 23:05 To: Orion-Interest Subject: Re: Integrating LOG4J into Orion... ello, What I did was to have a initialising SLSB and let the startup servlet call it. It works for me. cheers romen - Original Message - From: Alex Paransky [EMAIL PROTECTED] To: Orion-Interest [EMAIL PROTECTED] Sent: Saturday, January 19, 2002 12:34 PM Subject: FW: Integrating LOG4J into Orion... One more time, the last one did not show up -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 11:09 AM To: Orion-Interest Subject: Integrating LOG4J into Orion... I have a full EJB/JSP application running with Orion. Is there a preferred method of initializing LOG4J in this situation? Looking at the LOG4J documentation, they mention using a startup servlet to do the initialization. I am concerned as to how this would work with the CLASSLOADER hierarchy. If I initialize my LOG4J at the servlet (WEB) layer, will the EJB's be able to see the initialized LOG4J or will they attempt to re-initialize due to the different classloader? Thanks. -AP_
Re: Integrating LOG4J into Orion...
Further to what Mike has said, I'll just give you a little update on the status of the Log4j 1.2 release. The 1.2 code base is largely different to the 1.1 base, and has features that when finished, will be useful for using in application servers, and make it a lot easier to configure. The features that I talk about are: - Different LogManagers. This will allow Orion to provide a logmanager *per application*, or if it can't find one, use the default logmanager. This means that you will be able to specify a configuration file per application, and not have to manually configure it. - Configuration files will be reloaded The watchers code is being rewritten. When it is finished, you will most likely have code that allows you to configure how often the config files are reloaded (and stop / restart the watcher thread). So what does this mean for you, if you are using log4j in your application now? - Use the 1.2 code. Although in alpha, it is quite stable. - If you have specific requirements (apart from the above two), suggest them on the log4j email list, or email me with your suggestions. Lastly - congratulations on using log4j. Logging is very important in enterprise applications! Cheers, Scott -- Scott Farquhar :: [EMAIL PROTECTED] Atlassian :: http://www.atlassian.com Supporting YOUR J2EE World Mike Cannon-Brookes wrote: This is one possible scenario - but as Jeff says it's server specific logging (not application specific) - which can often be non-optimal. We have a document coming out on this (check http://kb.atlassian.com) soon, but until it's finished here's what we usually do: - use the latest log4j from CVS (which has the capability to define which is the default log loading class - there is now one which loads log4j.xml from classpath, and watches it) - I believe it's done via system properties (selecting automated file loader and watch time) - add a library path=config / to your orion-application.xml for each application - add config/log4j.xml to your application You're done! this means you now have : - automatic log configuration (no more need for servlet listeners, application clients or servlets to configure logging!) - dynamic logging (you can just change the log4j.xml file and your changes are picked up without redeployment) - logging _per application_ (rather than per server) As I said, see if the above directions work for you and please email me off list if they don't (so we can adjust the document in progress). Watch this space for the doco coming soon ;) Hope this helps! Mike Mike Cannon-Brookes [EMAIL PROTECTED] Atlassian :: www.atlassian.com Supporting YOUR world Now just configure log4j.xml On 19/1/02 4:40 AM, Jeff Schnitzer ([EMAIL PROTECTED]) penned the words: I put the log4j.jar in orion's lib directory, and use -Dlog4j.configuration=file:path/to/log4j.properties to initialize log4j. I'm pretty happy with this approach. I control logging on a server-wide basis, so I can use the same ear file for both testing and deployment. Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 5:35 PM To: Orion-Interest Subject: FW: Integrating LOG4J into Orion... One more time, the last one did not show up -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 11:09 AM To: Orion-Interest Subject: Integrating LOG4J into Orion... I have a full EJB/JSP application running with Orion. Is there a preferred method of initializing LOG4J in this situation? Looking at the LOG4J documentation, they mention using a startup servlet to do the initialization. I am concerned as to how this would work with the CLASSLOADER hierarchy. If I initialize my LOG4J at the servlet (WEB) layer, will the EJB's be able to see the initialized LOG4J or will they attempt to re-initialize due to the different classloader? Thanks. -AP_
Re: Integrating LOG4J into Orion...
ello, What I did was to have a initialising SLSB and let the startup servlet call it. It works for me. cheers romen - Original Message - From: Alex Paransky [EMAIL PROTECTED] To: Orion-Interest [EMAIL PROTECTED] Sent: Saturday, January 19, 2002 12:34 PM Subject: FW: Integrating LOG4J into Orion... One more time, the last one did not show up -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 11:09 AM To: Orion-Interest Subject: Integrating LOG4J into Orion... I have a full EJB/JSP application running with Orion. Is there a preferred method of initializing LOG4J in this situation? Looking at the LOG4J documentation, they mention using a startup servlet to do the initialization. I am concerned as to how this would work with the CLASSLOADER hierarchy. If I initialize my LOG4J at the servlet (WEB) layer, will the EJB's be able to see the initialized LOG4J or will they attempt to re-initialize due to the different classloader? Thanks. -AP_
RE: Integrating LOG4J into Orion...
I put the log4j.jar in orion's lib directory, and use -Dlog4j.configuration=file:path/to/log4j.properties to initialize log4j. I'm pretty happy with this approach. I control logging on a server-wide basis, so I can use the same ear file for both testing and deployment. Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 5:35 PM To: Orion-Interest Subject: FW: Integrating LOG4J into Orion... One more time, the last one did not show up -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 11:09 AM To: Orion-Interest Subject: Integrating LOG4J into Orion... I have a full EJB/JSP application running with Orion. Is there a preferred method of initializing LOG4J in this situation? Looking at the LOG4J documentation, they mention using a startup servlet to do the initialization. I am concerned as to how this would work with the CLASSLOADER hierarchy. If I initialize my LOG4J at the servlet (WEB) layer, will the EJB's be able to see the initialized LOG4J or will they attempt to re-initialize due to the different classloader? Thanks. -AP_
Re: Integrating LOG4J into Orion...
This is one possible scenario - but as Jeff says it's server specific logging (not application specific) - which can often be non-optimal. We have a document coming out on this (check http://kb.atlassian.com) soon, but until it's finished here's what we usually do: - use the latest log4j from CVS (which has the capability to define which is the default log loading class - there is now one which loads log4j.xml from classpath, and watches it) - I believe it's done via system properties (selecting automated file loader and watch time) - add a library path=config / to your orion-application.xml for each application - add config/log4j.xml to your application You're done! this means you now have : - automatic log configuration (no more need for servlet listeners, application clients or servlets to configure logging!) - dynamic logging (you can just change the log4j.xml file and your changes are picked up without redeployment) - logging _per application_ (rather than per server) As I said, see if the above directions work for you and please email me off list if they don't (so we can adjust the document in progress). Watch this space for the doco coming soon ;) Hope this helps! Mike Mike Cannon-Brookes [EMAIL PROTECTED] Atlassian :: www.atlassian.com Supporting YOUR world Now just configure log4j.xml On 19/1/02 4:40 AM, Jeff Schnitzer ([EMAIL PROTECTED]) penned the words: I put the log4j.jar in orion's lib directory, and use -Dlog4j.configuration=file:path/to/log4j.properties to initialize log4j. I'm pretty happy with this approach. I control logging on a server-wide basis, so I can use the same ear file for both testing and deployment. Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 5:35 PM To: Orion-Interest Subject: FW: Integrating LOG4J into Orion... One more time, the last one did not show up -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 11:09 AM To: Orion-Interest Subject: Integrating LOG4J into Orion... I have a full EJB/JSP application running with Orion. Is there a preferred method of initializing LOG4J in this situation? Looking at the LOG4J documentation, they mention using a startup servlet to do the initialization. I am concerned as to how this would work with the CLASSLOADER hierarchy. If I initialize my LOG4J at the servlet (WEB) layer, will the EJB's be able to see the initialized LOG4J or will they attempt to re-initialize due to the different classloader? Thanks. -AP_
FW: Integrating LOG4J into Orion...
One more time, the last one did not show up -Original Message- From: Alex Paransky [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 11:09 AM To: Orion-Interest Subject: Integrating LOG4J into Orion... I have a full EJB/JSP application running with Orion. Is there a preferred method of initializing LOG4J in this situation? Looking at the LOG4J documentation, they mention using a startup servlet to do the initialization. I am concerned as to how this would work with the CLASSLOADER hierarchy. If I initialize my LOG4J at the servlet (WEB) layer, will the EJB's be able to see the initialized LOG4J or will they attempt to re-initialize due to the different classloader? Thanks. -AP_