You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Ford, Peter" <Pe...@travelocity.com> on 2005/06/11 00:26:38 UTC

Default log4j initialization

Hi,

I'm trying to get log4j to initialize when my app starts up, but it
doesn't seem to be working.

My command line includes "-Dlog4j.configuration=cfg/logger.xml" and my
"main()" method does an explicit call to Logger.getLogger() to force the
Logger class to load and hence get the static initializer to run.

It just isn't working. I'm having to follow the getLogger() call with
DOMConfigurator.configure(System.getProperty("log4j.configuration")) to
get it to set up. I have no idea what I've missed here.

I'm using log4j 1.2.9; the manual says the default initialization is in
the Logger class's static initializer... But when I looked at the source
of the Logger class I couldn't find any static initializer (or in the
Category class that it extends).

--Pete

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Default log4j initialization

Posted by Anand Vijay <r1...@freescale.com>.
Hi 

Thanks All a lot , it works .... 
  ----- Original Message ----- 
  From: vi.hong@gsa.gov 
  To: Log4J Users List 
  Cc: Log4J Users List ; Anand Vijay 
  Sent: Monday, June 13, 2005 7:40 PM
  Subject: Re: Default log4j initialization



  Hi, 

  Can you put Dlog4j.debug=true in the properties file?  Instead of  adding it to Tomcat which run the debugger every time.  If it is in the properties file, then is only apply to that application that you are currently running. 

  Thanks, 
  Vi 






        "Jacob Kjome" <ho...@visi.com> 
        06/13/2005 10:04 AM Please respond to
              "Log4J Users List" <lo...@logging.apache.org> 


       To "Log4J Users List" <lo...@logging.apache.org>, "Anand Vijay" <r1...@freescale.com>  
              cc  
              Subject Re: Default log4j initialization 

              

       



  Quoting Anand Vijay <r1...@freescale.com>:

  > Hi James
  >
  > Thanks for the reply
  >
  > I start tomcat through shortcut icons(windows). where do  i need to specify
  > it?
  >

  You can add it to an OS system property called "CATALINA_OPTS".  That will get
  added inline with the java command to start Tomcat.  So, do...

  set CATALINA_OPTS=-Dlog4j.debug=true

  Either set that as a permanent OS property or set it in the current command
  environment and then run Tomcat from that same command window.


  Jake

  >
  > ----- Original Message -----
  > From: "James Stauffer" <st...@gmail.com>
  > To: "Log4J Users List" <lo...@logging.apache.org>
  > Sent: Monday, June 13, 2005 6:07 PM
  > Subject: Re: Default log4j initialization
  >
  >
  > Add -log4j.debug to the command line to get more info about how it
  > tries to search for the config file.  That should tell you what is
  > going wrong.
  >
  > On 6/10/05, Ford, Peter <Pe...@travelocity.com> wrote:
  > >
  > > Hi,
  > >
  > > I'm trying to get log4j to initialize when my app starts up, but it
  > > doesn't seem to be working.
  > >
  > > My command line includes "-Dlog4j.configuration=cfg/logger.xml" and my
  > > "main()" method does an explicit call to Logger.getLogger() to force the
  > > Logger class to load and hence get the static initializer to run.
  > >
  > > It just isn't working. I'm having to follow the getLogger() call with
  > > DOMConfigurator.configure(System.getProperty("log4j.configuration")) to
  > > get it to set up. I have no idea what I've missed here.
  > >
  > > I'm using log4j 1.2.9; the manual says the default initialization is in
  > > the Logger class's static initializer... But when I looked at the source
  > > of the Logger class I couldn't find any static initializer (or in the
  > > Category class that it extends).
  > >
  > > --Pete
  > >
  > > ---------------------------------------------------------------------
  > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
  > > For additional commands, e-mail: log4j-user-help@logging.apache.org
  > >
  > >
  >
  >
  > --
  > James Stauffer
  > Are you good? Take the test at http://www.livingwaters.com/good/
  >
  > ---------------------------------------------------------------------
  > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
  > For additional commands, e-mail: log4j-user-help@logging.apache.org
  >
  >
  > ---------------------------------------------------------------------
  > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
  > For additional commands, e-mail: log4j-user-help@logging.apache.org
  >




  ---------------------------------------------------------------------
  To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
  For additional commands, e-mail: log4j-user-help@logging.apache.org




Re: Default log4j initialization

Posted by vi...@gsa.gov.
Hi,

Can you put Dlog4j.debug=true in the properties file?  Instead of  adding 
it to Tomcat which run the debugger every time.  If it is in the 
properties file, then is only apply to that application that you are 
currently running.

Thanks,
Vi







"Jacob Kjome" <ho...@visi.com> 
06/13/2005 10:04 AM
Please respond to
"Log4J Users List" <lo...@logging.apache.org>


To
"Log4J Users List" <lo...@logging.apache.org>, "Anand Vijay" 
<r1...@freescale.com>
cc

Subject
Re: Default log4j initialization






Quoting Anand Vijay <r1...@freescale.com>:

> Hi James
>
> Thanks for the reply
>
> I start tomcat through shortcut icons(windows). where do  i need to 
specify
> it?
>

You can add it to an OS system property called "CATALINA_OPTS".  That will 
get
added inline with the java command to start Tomcat.  So, do...

set CATALINA_OPTS=-Dlog4j.debug=true

Either set that as a permanent OS property or set it in the current 
command
environment and then run Tomcat from that same command window.


Jake

>
> ----- Original Message -----
> From: "James Stauffer" <st...@gmail.com>
> To: "Log4J Users List" <lo...@logging.apache.org>
> Sent: Monday, June 13, 2005 6:07 PM
> Subject: Re: Default log4j initialization
>
>
> Add -log4j.debug to the command line to get more info about how it
> tries to search for the config file.  That should tell you what is
> going wrong.
>
> On 6/10/05, Ford, Peter <Pe...@travelocity.com> wrote:
> >
> > Hi,
> >
> > I'm trying to get log4j to initialize when my app starts up, but it
> > doesn't seem to be working.
> >
> > My command line includes "-Dlog4j.configuration=cfg/logger.xml" and my
> > "main()" method does an explicit call to Logger.getLogger() to force 
the
> > Logger class to load and hence get the static initializer to run.
> >
> > It just isn't working. I'm having to follow the getLogger() call with
> > DOMConfigurator.configure(System.getProperty("log4j.configuration")) 
to
> > get it to set up. I have no idea what I've missed here.
> >
> > I'm using log4j 1.2.9; the manual says the default initialization is 
in
> > the Logger class's static initializer... But when I looked at the 
source
> > of the Logger class I couldn't find any static initializer (or in the
> > Category class that it extends).
> >
> > --Pete
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org




Re: Default log4j initialization

Posted by Jacob Kjome <ho...@visi.com>.
Quoting Anand Vijay <r1...@freescale.com>:

> Hi James
>
> Thanks for the reply
>
> I start tomcat through shortcut icons(windows). where do  i need to specify
> it?
>

You can add it to an OS system property called "CATALINA_OPTS".  That will get
added inline with the java command to start Tomcat.  So, do...

set CATALINA_OPTS=-Dlog4j.debug=true

Either set that as a permanent OS property or set it in the current command
environment and then run Tomcat from that same command window.


Jake

>
> ----- Original Message -----
> From: "James Stauffer" <st...@gmail.com>
> To: "Log4J Users List" <lo...@logging.apache.org>
> Sent: Monday, June 13, 2005 6:07 PM
> Subject: Re: Default log4j initialization
>
>
> Add -log4j.debug to the command line to get more info about how it
> tries to search for the config file.  That should tell you what is
> going wrong.
>
> On 6/10/05, Ford, Peter <Pe...@travelocity.com> wrote:
> >
> > Hi,
> >
> > I'm trying to get log4j to initialize when my app starts up, but it
> > doesn't seem to be working.
> >
> > My command line includes "-Dlog4j.configuration=cfg/logger.xml" and my
> > "main()" method does an explicit call to Logger.getLogger() to force the
> > Logger class to load and hence get the static initializer to run.
> >
> > It just isn't working. I'm having to follow the getLogger() call with
> > DOMConfigurator.configure(System.getProperty("log4j.configuration")) to
> > get it to set up. I have no idea what I've missed here.
> >
> > I'm using log4j 1.2.9; the manual says the default initialization is in
> > the Logger class's static initializer... But when I looked at the source
> > of the Logger class I couldn't find any static initializer (or in the
> > Category class that it extends).
> >
> > --Pete
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Default log4j initialization

Posted by Anand Vijay <r1...@freescale.com>.
Hi James

Thanks for the reply

I start tomcat through shortcut icons(windows). where do  i need to specify
it?


----- Original Message ----- 
From: "James Stauffer" <st...@gmail.com>
To: "Log4J Users List" <lo...@logging.apache.org>
Sent: Monday, June 13, 2005 6:07 PM
Subject: Re: Default log4j initialization


Add -log4j.debug to the command line to get more info about how it
tries to search for the config file.  That should tell you what is
going wrong.

On 6/10/05, Ford, Peter <Pe...@travelocity.com> wrote:
>
> Hi,
>
> I'm trying to get log4j to initialize when my app starts up, but it
> doesn't seem to be working.
>
> My command line includes "-Dlog4j.configuration=cfg/logger.xml" and my
> "main()" method does an explicit call to Logger.getLogger() to force the
> Logger class to load and hence get the static initializer to run.
>
> It just isn't working. I'm having to follow the getLogger() call with
> DOMConfigurator.configure(System.getProperty("log4j.configuration")) to
> get it to set up. I have no idea what I've missed here.
>
> I'm using log4j 1.2.9; the manual says the default initialization is in
> the Logger class's static initializer... But when I looked at the source
> of the Logger class I couldn't find any static initializer (or in the
> Category class that it extends).
>
> --Pete
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Default log4j initialization

Posted by James Stauffer <st...@gmail.com>.
Add -log4j.debug to the command line to get more info about how it
tries to search for the config file.  That should tell you what is
going wrong.

On 6/10/05, Ford, Peter <Pe...@travelocity.com> wrote:
> 
> Hi,
> 
> I'm trying to get log4j to initialize when my app starts up, but it
> doesn't seem to be working.
> 
> My command line includes "-Dlog4j.configuration=cfg/logger.xml" and my
> "main()" method does an explicit call to Logger.getLogger() to force the
> Logger class to load and hence get the static initializer to run.
> 
> It just isn't working. I'm having to follow the getLogger() call with
> DOMConfigurator.configure(System.getProperty("log4j.configuration")) to
> get it to set up. I have no idea what I've missed here.
> 
> I'm using log4j 1.2.9; the manual says the default initialization is in
> the Logger class's static initializer... But when I looked at the source
> of the Logger class I couldn't find any static initializer (or in the
> Category class that it extends).
> 
> --Pete
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org