Hi,

It works for me with properties file, thanks guys.

Best regards.

-----Original Message-----
From: Matt Sicker [mailto:[email protected]] 
Sent: Friday, June 24, 2016 10:40 PM
To: Log4J Users List
Subject: Re: how to ensure my hook is invoked before shutdown hook of log4j

You can also specify the JVM parameters through a file called 
log4j2.component.properties

On 24 June 2016 at 07:48, Ralph Goers <[email protected]> wrote:

> If you have code that runs at startup and shutdown then you should 
> programmatically start and stop Log4j from there and turn off Log4j’s 
> automatic handling of it.  You would call Configurator.initialize at 
> startup and Configurator.shutdown from your shutdown hook.
>
> Ralph
>
> > On Jun 24, 2016, at 3:25 AM, Maple Wang 
> > <[email protected]>
> wrote:
> >
> > Hi,
> >
> > I registered a shutdownhook in my code and found that there is no 
> > any
> log output from my hook method, the reason is that since log4j2.1, 
> shutdown hook registry will be enabled by default from log4j, logger 
> is stopped by log4j's hook before my hook is invoked.
> >
> > Of course I can disable the hook from log4j by
> "-Dlog4j.shutdownHookEnabled=false", but I think it might be better to 
> keep it, so I wonder if there is way to ensure my hook is invoked 
> before log4j's hook.
> >
> > And if there is no that way, is there any programmatic way to 
> > disable
> the log4j's shutdownhook rather than JVM parameter.
> >
> > Thanks in advance.
> >
> > Best regards.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


--
Matt Sicker <[email protected]>

Reply via email to