RE: Creating Loggers at Deployment Time

2004-04-06 Thread Farrell, Patrick
Jason,

Thanks for the tip.

I ended up also finding a solution that will meet my needs.  Apparently,
you may create a configuration file in the webapps folder that contains
fragments from the server.xml file.  The configuration file needs to be
named according to the application context that you are intending to
configure.  Example:  mywebapp.xml could contain configuration fragments
for the /mywebapp context.  The snippet shown below will create a new
filelogger for the /mywebapp context:

 Begin --



  


  End  --

Patrick M. Farrell
Client Care Manager
Client Server & Web Development
Quick Solutions, Inc.
A four time INC 500 winner!
[EMAIL PROTECTED]
614.336.4368 (Client)
614.561.5285 (Mobile)
740.548.0539 (Home)

-Original Message-
From: Jason Bucholtz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 11:22 AM
To: Tomcat Users List
Subject: Re: Creating Loggers at Deployment Time


Patrick,

I have done this using a the Java logging API in conjunction with a
context listener.  When your application loads, you have the context
listener configure the logger to do the output you want.  In my case I
create a log in the $CATALINA_HOME/logs directory named after the app
and do standard revolving logfiles.  I also set the default logging
level here.

The nice thing about the logging api is that it is hierarchical and so
once you have configured the root logger, additional loggers (one per
class in my case) can be set as children to the root.  All the children
will use the properties of the root (like the log file you defined)  as
well as have their own properties which you can adjust to suit your
debugging situation.  Using this approach allows you to set the
debugging level of a class  higher if you are working on it and it
leaves the other classes in a 'quiet' mode.

One of the things I really like about the java logging API is that it
allows you to change the loggin level at runtime.  In my application I
will be adding a management interface that will allow  changing the
debug level of a specific class on a deployed application at runtime.

Jason

On Tue, 6 Apr 2004, Farrell, Patrick wrote:

> I would like to pre-configure a web application to automatically 
> create a logger with certain settings when the application is deployed

> to Tomcat 4.1.X.  Is there a tomcat-specific configuration file that I

> can add to the WAR in order to accomplish this, or is editing the 
> server.xml the only way to create a logger?
>
> If it is not possible to accomplish this task via a configuration 
> file, could it be done using a startup servlet in the application?  
> This class would have to use the Tomcat API directly in order to 
> create a logger .. but it seems possible.  Has anyone tried this 
> before?
>
> Thanks in advance,
>
> Patrick M. Farrell
> Client Care Manager
> Client Server & Web Development
> Quick Solutions, Inc.
> A four time INC 500 winner!
> [EMAIL PROTECTED]
>
> **
> *
> This message is intended only for the use of the intended recipient
and
> may contain information that is PRIVILEGED and/or CONFIDENTIAL.  If
you
> are not the intended recipient, you are hereby notified that any use,
> dissemination, disclosure or copying of this communication is strictly
> prohibited.  If you have received this communication in error, please
> destroy all copies of this message and its attachments and notify us
> immediately.
>
***
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


***
This message is intended only for the use of the intended recipient and
may contain information that is PRIVILEGED and/or CONFIDENTIAL.  If you
are not the intended recipient, you are hereby notified that any use,
dissemination, disclosure or copying of this communication is strictly
prohibited.  If you have received this communication in error, please
destroy all copies of this message and its attachments and notify us
immediately.
***


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Creating Loggers at Deployment Time

2004-04-06 Thread Jason Bucholtz
Patrick,

I have done this using a the Java logging API in conjunction with a
context listener.  When your application loads, you have the context
listener configure the logger to do the output you want.  In my case I
create a log in the $CATALINA_HOME/logs directory named after the app and
do standard revolving logfiles.  I also set the default logging level
here.

The nice thing about the logging api is that it is hierarchical and so
once you have configured the root logger, additional loggers (one per
class in my case) can be set as children to the root.  All the children
will use the properties of the root (like the log file you defined)  as
well as have their own properties which you can adjust to suit your
debugging situation.  Using this approach allows you to set the debugging
level of a class  higher if you are working on it and it leaves the other
classes in a 'quiet' mode.

One of the things I really like about the java logging API is that it
allows you to change the loggin level at runtime.  In my application I
will be adding a management interface that will allow  changing the debug level
of a specific class on a deployed application at runtime.

Jason

On Tue, 6 Apr 2004, Farrell, Patrick wrote:

> I would like to pre-configure a web application to automatically create
> a logger with certain settings when the application is deployed to
> Tomcat 4.1.X.  Is there a tomcat-specific configuration file that I can
> add to the WAR in order to accomplish this, or is editing the server.xml
> the only way to create a logger?
>
> If it is not possible to accomplish this task via a configuration file,
> could it be done using a startup servlet in the application?  This class
> would have to use the Tomcat API directly in order to create a logger ..
> but it seems possible.  Has anyone tried this before?
>
> Thanks in advance,
>
> Patrick M. Farrell
> Client Care Manager
> Client Server & Web Development
> Quick Solutions, Inc.
> A four time INC 500 winner!
> [EMAIL PROTECTED]
>
> ***
> This message is intended only for the use of the intended recipient and
> may contain information that is PRIVILEGED and/or CONFIDENTIAL.  If you
> are not the intended recipient, you are hereby notified that any use,
> dissemination, disclosure or copying of this communication is strictly
> prohibited.  If you have received this communication in error, please
> destroy all copies of this message and its attachments and notify us
> immediately.
> ***
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]