-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fb-DSS-2633-Performance_StressTest_client_does_not_prin…
…t_the_result' into 'main' DSS-2633: performance stresstest client does not print the result See merge request signserver/signserver!304
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
signserver/modules/SignServer-CLI-Common/src/main/java/org/signserver/cli/Log4jHelper.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,37 @@ | ||
/************************************************************************* | ||
* * | ||
* SignServer: The OpenSource Automated Signing Server * | ||
* * | ||
* This software is free software; you can redistribute it and/or * | ||
* modify it under the terms of the GNU Lesser General Public * | ||
* License as published by the Free Software Foundation; either * | ||
* version 2.1 of the License, or any later version. * | ||
* * | ||
* See terms of license at gnu.org. * | ||
* * | ||
*************************************************************************/ | ||
package org.signserver.cli; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.core.impl.Log4jContextFactory; | ||
import org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry; | ||
import org.apache.logging.log4j.spi.LoggerContextFactory; | ||
|
||
/** | ||
* Class containing helper method for log4j. | ||
* | ||
* @author Nima Saboonchi | ||
*/ | ||
public class Log4jHelper { | ||
|
||
/** | ||
* Helper method for disabling the shutdown hook in log4j. | ||
*/ | ||
public static void disableShutdownHook(){ | ||
final LoggerContextFactory loggerContextFactory = LogManager.getFactory(); | ||
if (loggerContextFactory instanceof Log4jContextFactory) { | ||
Log4jContextFactory contextFactory = (Log4jContextFactory) loggerContextFactory; | ||
((DefaultShutdownCallbackRegistry) contextFactory.getShutdownCallbackRegistry()).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