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 Guðlaugur Stefán Egilsson <gs...@dimonsoftware.com> on 2003/09/24 16:12:41 UTC

Closed appender issue on configuration reload

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

I have a minor problem with reloading my log4j configuration.
I am working with an application which is deployed as a web
service within Tomcat. There are other applications deployed
there as well, and all of them need to use a common
RemoteAppender. There can be only one RemoteAppender, since it
binds to a TCP port, which is of course exclusive.

To get that to work required a little bit of code, but 
essentially I used the Servlet approach described in the manual,
and extended it to get the appender and add it to newly created
loggers. This works quite nicely until a reload of the web
service occurs. What happens then is that the Servlet is reloaded,
causing reload of the configuration, with the loggers already
existing 
this time. This prompts the configurator to remove all existing 
appenders from the loggers, which for some reason closes the
appenders 
too. (why is that necessary??). This of course closes the
RemoteAppender,
thereby rendering it useless to all the services using it.

So, my first question is, is there any short way around this? 

And the second question is, is this desirable behaviour? It seems to
me that a reconfiguration should not have adverse side effects, such
as closing appenders which are not reopened automatically...

Regards

Guðlaugur Stefán Egilsson
Dimon Software
http://www.dimonsoftware.com


-----BEGIN PGP SIGNATURE-----
Version: PGP 7.1.1

iQA/AwUBP3GmWEJoRUzTQtNXEQI1UgCgtZCKfi7thc3axGHSpU3c2cjeGt0AoI0E
isBtIiq4KwOyVdB/lKMyH2ei
=4J7O
-----END PGP SIGNATURE-----


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


RE: Closed appender issue on configuration reload

Posted by Guðlaugur Stefán Egilsson <gs...@dimonsoftware.com>.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You would be right if that was the purpose. But its purpose
is to push events to remote clients, not to receive them...

Guðlaugur Stefán Egilsson
Dimon Software
http://www.dimonsoftware.com



> -----Original Message-----
> From: Ceki Gülcü [mailto:ceki@qos.ch] 
> Sent: 24. september 2003 14:51
> To: Log4J Users List
> Subject: Re: Closed appender issue on configuration reload
> 
> 
> Why is 'RemoteAppender' an appender? If the purpose of 
> 'RemoteAppender' is 
> to receive events from remote clients, it should not be an 
> appender. Right?
> 
> At 02:12 PM 9/24/2003 +0000, you wrote:
> >
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >Hi
> >
> >I have a minor problem with reloading my log4j configuration. I am
> > working with an application which is deployed as a web 
> service within 
> >Tomcat. There are other applications deployed there as well, 
> and all of 
> >them need to use a common RemoteAppender. There can be only one 
> >RemoteAppender, since it binds to a TCP port, which is of course 
> >exclusive.
> >
> >To get that to work required a little bit of code, but essentially
> >I  used the Servlet approach described in the manual, and 
> extended it to 
> >get the appender and add it to newly created loggers. This 
> works quite 
> >nicely until a reload of the web service occurs. What 
> happens then is 
> >that the Servlet is reloaded, causing reload of the 
> configuration, with 
> >the loggers already existing
> >this time. This prompts the configurator to remove all existing
> >appenders from the loggers, which for some reason closes the
> >appenders
> >too. (why is that necessary??). This of course closes the
> >RemoteAppender,
> >thereby rendering it useless to all the services using it.
> >
> >So, my first question is, is there any short way around this?
> >
> >And the second question is, is this desirable behaviour? It 
> seems to me 
> >that a reconfiguration should not have adverse side effects, such
> >as  closing appenders which are not reopened automatically...
> >
> >Regards
> >
> >Guðlaugur Stefán Egilsson
> >Dimon Software
> >http://www.dimonsoftware.com
> 
> -- 
> Ceki Gülcü
> 
>       For log4j documentation consider "The complete log4j manual"
>       ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
> 
>       import org.apache.Facetime;
>       ApacheCon US 2003, 18-21 November http://apachecon.com/
> 
> 
> 
> --------------------------------------------------------------------
> - To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 

-----BEGIN PGP SIGNATURE-----
Version: PGP 7.1.1

iQA/AwUBP3Gy3UJoRUzTQtNXEQKmwACghm3TuC9lfoRCEN4raQoIS/beRyoAoIPi
KXulVxZr2Lwcc4vHL26hkcOV
=85Qi
-----END PGP SIGNATURE-----


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


Re: Closed appender issue on configuration reload

Posted by Ceki Gülcü <ce...@qos.ch>.
Why is 'RemoteAppender' an appender? If the purpose of 'RemoteAppender' is 
to receive events from remote clients, it should not be an appender. Right?

At 02:12 PM 9/24/2003 +0000, you wrote:
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Hi
>
>I have a minor problem with reloading my log4j configuration.
>I am working with an application which is deployed as a web
>service within Tomcat. There are other applications deployed
>there as well, and all of them need to use a common
>RemoteAppender. There can be only one RemoteAppender, since it
>binds to a TCP port, which is of course exclusive.
>
>To get that to work required a little bit of code, but
>essentially I used the Servlet approach described in the manual,
>and extended it to get the appender and add it to newly created
>loggers. This works quite nicely until a reload of the web
>service occurs. What happens then is that the Servlet is reloaded,
>causing reload of the configuration, with the loggers already
>existing
>this time. This prompts the configurator to remove all existing
>appenders from the loggers, which for some reason closes the
>appenders
>too. (why is that necessary??). This of course closes the
>RemoteAppender,
>thereby rendering it useless to all the services using it.
>
>So, my first question is, is there any short way around this?
>
>And the second question is, is this desirable behaviour? It seems to
>me that a reconfiguration should not have adverse side effects, such
>as closing appenders which are not reopened automatically...
>
>Regards
>
>Guðlaugur Stefán Egilsson
>Dimon Software
>http://www.dimonsoftware.com

-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp

      import org.apache.Facetime;
      ApacheCon US 2003, 18-21 November http://apachecon.com/



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


RE: Closed appender issue on configuration reload

Posted by Guðlaugur Stefán Egilsson <gs...@dimonsoftware.com>.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Well, I didn't implement it myself, but what it does is basically
waiting for clients to connect to it (thus using a server socket).
The client then requests logging information from the server 
(that is, the RemoteAppender), which replies with the logging 
entry whenever it becomes available. This is something that has
been in use here for quite a while, and works quite well.

Guðlaugur Stefán Egilsson
Dimon Software
http://www.dimonsoftware.com



> -----Original Message-----
> From: Ceki Gülcü [mailto:ceki@qos.ch] 
> Sent: 24. september 2003 15:15
> To: Log4J Users List
> Subject: Re: Closed appender issue on configuration reload
> 
> 
> At 02:12 PM 9/24/2003 +0000, Guðlaugur Stefán Egilsson wrote:
> >
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >Hi
> >
> >I have a minor problem with reloading my log4j configuration. I am
> > working with an application which is deployed as a web 
> service within 
> >Tomcat. There are other applications deployed there as well, 
> and all of 
> >them need to use a common RemoteAppender. There can be only one 
> >RemoteAppender, since it binds to a TCP port, which is of course 
> >exclusive.
> 
> Hmm. That does not sound right. You can have as many 
> SocketApenders as you 
> want. You mean SocketAppender don't you?
> 
> The server port is exclusive, client ports are not.
> 
> --
> Ceki Gülcü
> 
>       For log4j documentation consider "The complete log4j manual"
>       ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
> 
>       import org.apache.Facetime;
>       ApacheCon US 2003, 18-21 November http://apachecon.com/
> 
> 
> 
> --------------------------------------------------------------------
> - To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 

-----BEGIN PGP SIGNATURE-----
Version: PGP 7.1.1

iQA/AwUBP3G9jkJoRUzTQtNXEQJgVgCginQKPxU3RjkJBZX3JguTvNnYCWoAnA+M
B0kIhQZl9IgPMd/3Rj1Szuua
=Y5/Z
-----END PGP SIGNATURE-----


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


Re: Closed appender issue on configuration reload

Posted by Ceki Gülcü <ce...@qos.ch>.
At 02:12 PM 9/24/2003 +0000, Guðlaugur Stefán Egilsson wrote:
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Hi
>
>I have a minor problem with reloading my log4j configuration.
>I am working with an application which is deployed as a web
>service within Tomcat. There are other applications deployed
>there as well, and all of them need to use a common
>RemoteAppender. There can be only one RemoteAppender, since it
>binds to a TCP port, which is of course exclusive.

Hmm. That does not sound right. You can have as many SocketApenders as you 
want. You mean SocketAppender don't you?

The server port is exclusive, client ports are not.

--
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp

      import org.apache.Facetime;
      ApacheCon US 2003, 18-21 November http://apachecon.com/



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