You can also specify the JVM parameters through a file called log4j2.component.properties
On 24 June 2016 at 07:48, Ralph Goers <ralph.go...@dslextreme.com> 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 <maple.feng.w...@hotmail.com> > 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: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > > -- Matt Sicker <boa...@gmail.com>