-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the
logging
sample application and include the `jpro.onJVMSh…
…utdown` configuration
- Loading branch information
Showing
6 changed files
with
105 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
logging/src/main/java/one/jpro/samples/logging/LogOnJVMShutdown.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package one.jpro.samples.logging; | ||
|
||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
/** | ||
* This is a simple class that will be executed on JVM startup. | ||
* | ||
* @author Besmir Beqiri | ||
*/ | ||
public class LogOnJVMShutdown { | ||
|
||
private static final Logger jullogger = Logger.getLogger(LogOnJVMShutdown.class.getName()); | ||
|
||
public static void main(String[] args) { | ||
|
||
jullogger.log(Level.INFO, "JUL Logging on JVM Shutdown!"); | ||
|
||
for (java.util.logging.Handler handler : Logger.getLogger("").getHandlers()) { | ||
handler.flush(); | ||
} | ||
LogOnJVMStartup.julShutdownTrigger.complete(null); | ||
LogOnJVMStartup.loggerContext.stop(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
jpro.logConsole=false | ||
jpro.logToJUL=true | ||
jpro.onJVMStartup=one.jpro.samples.logging.LogOnJVMStartup | ||
jpro.onFXStartup=one.jpro.samples.logging.LogOnFXStartup | ||
jpro.forceShutdown = false | ||
jpro.onJVMStartup=one.jpro.maven.LogOnJVMStartup | ||
jpro.onJVMShutdown=one.jpro.maven.LogOnJVMShutdown | ||
jpro.onFXStartup=one.jpro.maven.LogOnFXStartup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters