MIchalloo
MIchalloo

Reputation: 3

Log4j Default Close Operation Log

How to get an exit application log of jFrame in log4j when i have set

setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

Upvotes: 0

Views: 45

Answers (1)

user4039871
user4039871

Reputation:

You should add a ShutdownHook to the main() method. Then you can do whatever you want inside the hook, including logging before the application closes.

Ref: http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29

Upvotes: 1

Related Questions