Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 1e312171 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Fix Bamboo plan

parent 8e7997f7
No related branches found
No related tags found
No related merge requests found
......@@ -33,11 +33,15 @@ public class FileProperty {
private FileProperty() {
}
public static void updateLog4jConfiguration(String logFileFolder, String logPropertyFile, String configurationFolder) {
public static void updateLogConfiguration(String logFileFolder, String logPropertyFile, String configurationFolder) {
if (StringUtils.isNotBlank(logFileFolder)) {
System.setProperty(PROPERTY_LOG_FOLDER, logFileFolder);
}
if (StringUtils.isBlank(logPropertyFile)) {
LOG.info("Log configuration file is not set.");
return;
}
File f = new File(logPropertyFile);
if (!f.exists()) {
......@@ -54,7 +58,7 @@ public class FileProperty {
public static void setLogConfiguration(File configurationFile) {
try (InputStream configStream = new FileInputStream(configurationFile)) {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
configurator.doConfigure(configStream); // loads logback file
......
......@@ -57,7 +57,7 @@ public class PropertiesConfig {
// log application properties
PROP_INIT_TOOLS.logBuildProperties();
// update log configuration
FileProperty.updateLog4jConfiguration(fileProperties.getProperty(FileProperty.PROPERTY_LOG_FOLDER),
FileProperty.updateLogConfiguration(fileProperties.getProperty(FileProperty.PROPERTY_LOG_FOLDER),
fileProperties.getProperty(FileProperty.PROPERTY_LOG_PROPERTIES), prop.getProperty(CONFIGURATION_DIR.getProperty())
);
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- pattern definition -->
<property name="encoderPattern" value="%d{ISO8601} [%X{d_user}] [%X{d_domain}] [%X{d_messageId}] [%thread] %5p %c{1}:%L - %m%n" scope="global"/>
<property name="consolePattern" value="%d{ISO8601} [%X{d_user}] [%X{d_domain}] [%X{d_messageId}] [%thread] %5p %c{1}:%L - %m%n" scope="global"/>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.folder:-logs}/edelivery-smp.log</file>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>SECURITY</marker>
<marker>BUSINESS</marker>
</evaluator>
<onMismatch>NEUTRAL</onMismatch>
<onMatch>DENY</onMatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${log.folder:-logs}/edelivery-smp-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- each file should be at most 30MB, keep 60 days worth of history, but at most 20GB -->
<maxFileSize>30MB</maxFileSize>
<maxHistory>60</maxHistory>
<totalSizeCap>20GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>${encoderPattern}</pattern>
</encoder>
</appender>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<Target>System.out</Target>
<encoder>
<pattern>${consolePattern}</pattern>
</encoder>
</appender>
<logger name="eu.europa.ec.edelivery.smp" level="INFO" />
<root level="WARN">
<appender-ref ref="file"/>
<appender-ref ref="stdout"/>
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- pattern definition -->
<property name="encoderPattern" value="%d{ISO8601} [%X{d_user}] [%X{d_domain}] [%X{d_messageId}] [%thread] %5p %c{1}:%L - %m%n" scope="global"/>
<property name="consolePattern" value="%d{ISO8601} [%X{d_user}] [%X{d_domain}] [%X{d_messageId}] [%thread] %5p %c{1}:%L - %m%n" scope="global"/>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.folder:-logs}/edelivery-smp.log</file>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>SECURITY</marker>
<marker>BUSINESS</marker>
</evaluator>
<onMismatch>NEUTRAL</onMismatch>
<onMatch>DENY</onMatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${log.folder:-logs}/edelivery-smp-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- each file should be at most 30MB, keep 60 days worth of history, but at most 20GB -->
<maxFileSize>30MB</maxFileSize>
<maxHistory>60</maxHistory>
<totalSizeCap>20GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>${encoderPattern}</pattern>
</encoder>
</appender>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<Target>System.out</Target>
<encoder>
<pattern>${consolePattern}</pattern>
</encoder>
</appender>
<logger name="eu.europa.ec.edelivery.smp" level="INFO" />
<root level="WARN">
<appender-ref ref="file"/>
<appender-ref ref="stdout"/>
</root>
</configuration>
\ No newline at end of file
......@@ -51,7 +51,7 @@ jdbc.password=secret123
log.folder=../logs/
# custom log4j configuration file
# log.configuration.file=smp-log4j.properties
# log.configuration.file=smp-logback.xml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment