[
https://issues.apache.org/jira/browse/LOG4J2-318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13714416#comment-13714416
]
Maurizio Sartori edited comment on LOG4J2-318 at 7/20/13 12:53 PM:
-------------------------------------------------------------------
Here is a test that shows the problem.
If you leave the program run till end, the output is:
OUT: main: start
INFO main: start
OUT: run
INFO run
OUT: run: HELLO 0
INFO run: HELLO 0
OUT: main: ThreadPool 1
OUT: run: HELLO 1
INFO main: ThreadPool 1
INFO run: HELLO 1
OUT: main: ThreadPool 1
OUT: run: HELLO 2
INFO main: ThreadPool 1
INFO run: HELLO 2
OUT: main: ThreadPool 1
OUT: run: HELLO 3
INFO main: ThreadPool 1
INFO run: HELLO 3
OUT: run: HELLO 4
OUT: main: ThreadPool 1
INFO run: HELLO 4
INFO main: ThreadPool 1
OUT: main: ThreadPool 1
OUT: run: HELLO 5
INFO main: ThreadPool 1
INFO run: HELLO 5
OUT: main: ThreadPool 1
OUT: run: HELLO 6
INFO main: ThreadPool 1
INFO run: HELLO 6
OUT: main: ThreadPool 1
OUT: run: HELLO 7
INFO main: ThreadPool 1
INFO run: HELLO 7
OUT: run: HELLO 8
OUT: main: ThreadPool 1
INFO run: HELLO 8
INFO main: ThreadPool 1
OUT: run: HELLO 9
OUT: main: ThreadPool 1
INFO run: HELLO 9
INFO main: ThreadPool 1
OUT: run: done
OUT: main: ThreadPool 1
INFO run: done
OUT: run: exit
INFO main: ThreadPool 1
INFO run: exit
OUT: main: terminated
INFO main: terminated
OUT: main: exit
INFO main: exit
2013-07-20 14:52:49,609 DEBUG Shutting down OutputStreamManager SYSTEM_OUT
If you hit CtrlC the output is:
OUT: main: start
INFO main: start
OUT: run
INFO run
OUT: run: HELLO 0
INFO run: HELLO 0
OUT: run: HELLO 1
INFO run: HELLO 1
OUT: main: ThreadPool 1
INFO main: ThreadPool 1
OUT: run: HELLO 2
OUT: main: ThreadPool 1
INFO run: HELLO 2
INFO main: ThreadPool 1
OUT: run: HELLO 3
INFO run: HELLO 3
OUT: main: ThreadPool 1
INFO main: ThreadPool 1
^C
2013-07-20 14:51:35,636 DEBUG Shutting down OutputStreamManager SYSTEM_OUT
OUT: run: HELLO 4
OUT: main: ThreadPool 1
OUT: run: HELLO 5
OUT: main: ThreadPool 1
OUT: run: HELLO 6
OUT: main: ThreadPool 1
OUT: run: HELLO 7
OUT: main: ThreadPool 1
OUT: run: HELLO 8
OUT: main: ThreadPool 1
OUT: run: HELLO 9
OUT: main: ThreadPool 1
OUT: run: done
OUT: run: exit
OUT: main: ThreadPool 1
OUT: main: killed
OUT: main: exit
Note that all the last logs are LOST!
was (Author: masar):
Here is a test that shows the problem.
> On termination Log4j terminates before the application
> ------------------------------------------------------
>
> Key: LOG4J2-318
> URL: https://issues.apache.org/jira/browse/LOG4J2-318
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0-beta8
> Reporter: Maurizio Sartori
> Labels: shutdown
> Attachments: test.zip
>
>
> My application is multi-threaded, when Ctrl-C is pressed to terminate it,
> Log4J ShutdownHooks in LoggerContext are called to close the appenders, so I
> lost any log that the application does during its termination.
> What I think I need, is a way to disable the automatic close done by
> LoggerContext and a way to call the close by myself.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]