Thanks for the help!!!

But can you be a little more specific regarding the method like
setLogging()??

Regards,
Sumit Mishra
[EMAIL PROTECTED]
http://www.cash-tech.com/

-----Original Message-----
From: Log4J Users List [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 24, 2002 8:22 PM
To: Log4J Users List
Cc: 'Log4J Users List'
Subject: Re: AW: Logging On/Off


Another approach is to write the initialization servlet to work both
at initialization and when invoked as a normal application servlet.

I did this by writing the init method as:
    public void init() {
        locateConfigFile();  // establishes the String containing the
fully qualified config file name
        setLogging();        // loads the config file with
PropertyConfigurator
    } // .. init()

and the "normal" servlet methods as:
    public void doGet(HttpServletRequest  request,
                      HttpServletResponse response)
                throws ServletException, IOException
    {
        doService(request, response);
    }

    public void doPost(HttpServletRequest  request,
                       HttpServletResponse response)
                throws ServletException, IOException
    {
        doService(request, response);
    }

    private void doService(HttpServletRequest request,
                           HttpServletResponse response)
                 throws ServletException, IOException
    {
        // other code for determining where to dispatch to
        setLogging();
        // dispatching code
    }

Then the servlet can be used to reconfigure logging upon demand when
invoked as a normal part of the application - I use it as part of the
admin functions.

I hope this helps.




 

                    "Sauder

                    Thomas - IWKA        To:     "'Log4J Users List'"
<[EMAIL PROTECTED]>             
                    Informationss        cc:

                    ysteme GmbH"         Subject:     AW: Logging On/Off

                    <thomas.saude

                    [EMAIL PROTECTED]>

 

                    01/24/2002

                    03:01 AM

                    Please

                    respond to

                    "Log4J Users

                    List"

 

 




Maybe PropertyConfigurator.configureAndWatch helps you.
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurat

or.html

Regards,
Thomas

> I am using log4j with IBM websphere 3.5.4. Every time we have
> to switch off
> the logging, we comment the following line in log4j.prp file.
>
> log4j.rootCategory=debug, stdout, R
>
> Every time we have to switch on the logging, we uncomment the
> above line.
> We read the log4j.prp file in a stateless session bean which
> is invoked in
> the init of a startup Servlet.
>
> Problem we are facing is that every time we have to switch
> off the logging,
> we need to comment the above line in log4j.prp file and
> restart the app
> server again for the change to take effect. This is really
> painful because
> there are many users connected to the server at any point of time.
> Can you guys suggest any better way??
>
> Regards,
> Sumit Mishra
>  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
>  <http://www.cash-tech.com/> http://www.cash-tech.com/
>
>


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






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

Reply via email to