Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
aec38566
Commit
aec38566
authored
Oct 28, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify logic for locating default logging config
Fixes gh-1612, Fixes gh-1770
parent
11c1e5ed
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
120 additions
and
152 deletions
+120
-152
AbstractLoggingSystem.java
...g/springframework/boot/logging/AbstractLoggingSystem.java
+29
-9
JavaLoggingSystem.java
.../springframework/boot/logging/java/JavaLoggingSystem.java
+9
-17
Log4JLoggingSystem.java
...pringframework/boot/logging/log4j/Log4JLoggingSystem.java
+9
-15
Log4J2LoggingSystem.java
...ingframework/boot/logging/log4j2/Log4J2LoggingSystem.java
+6
-14
LogbackLoggingSystem.java
...gframework/boot/logging/logback/LogbackLoggingSystem.java
+10
-18
logging-none.properties
...springframework/boot/logging/java/logging-none.properties
+1
-4
logging.properties
.../org/springframework/boot/logging/java/logging.properties
+4
-1
log4j-none.properties
.../springframework/boot/logging/log4j/log4j-none.properties
+1
-6
log4j.properties
...s/org/springframework/boot/logging/log4j/log4j.properties
+6
-1
log4j2-none.xml
...s/org/springframework/boot/logging/log4j2/log4j2-none.xml
+0
-6
log4j2.xml
...ources/org/springframework/boot/logging/log4j2/log4j2.xml
+6
-0
base-file.xml
...es/org/springframework/boot/logging/logback/base-file.xml
+1
-1
base.xml
...sources/org/springframework/boot/logging/logback/base.xml
+13
-6
basic-console.xml
...rg/springframework/boot/logging/logback/basic-console.xml
+0
-18
basic-logback.xml
...rg/springframework/boot/logging/logback/basic-logback.xml
+1
-1
basic.xml
...ources/org/springframework/boot/logging/logback/basic.xml
+0
-20
logback-console.xml
.../springframework/boot/logging/logback/logback-console.xml
+0
-5
logback-file-console.xml
...ngframework/boot/logging/logback/logback-file-console.xml
+3
-4
logback-file.xml
...org/springframework/boot/logging/logback/logback-file.xml
+2
-3
logback-none.xml
...org/springframework/boot/logging/logback/logback-none.xml
+5
-0
logback.xml
...rces/org/springframework/boot/logging/logback/logback.xml
+1
-1
LoggingApplicationListenerTests.java
...amework/boot/logging/LoggingApplicationListenerTests.java
+13
-2
No files found.
spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java
View file @
aec38566
...
...
@@ -18,6 +18,7 @@ package org.springframework.boot.logging;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.StringUtils
;
/**
* Abstract base class for {@link LoggingSystem} implementations.
...
...
@@ -31,12 +32,23 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
private
final
String
[]
paths
;
public
AbstractLoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
this
.
classLoader
=
classLoader
;
this
.
paths
=
getLogFileName
(
fileOutput
,
consoleOutput
);
private
boolean
fileOutput
;
private
boolean
consoleOutput
;
public
AbstractLoggingSystem
(
ClassLoader
classLoader
)
{
this
(
classLoader
,
false
,
true
);
}
protected
abstract
String
[]
getLogFileName
(
boolean
fileOutput
,
boolean
consoleOutput
);
public
AbstractLoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
this
.
classLoader
=
classLoader
;
this
.
fileOutput
=
fileOutput
;
this
.
consoleOutput
=
consoleOutput
;
this
.
paths
=
getLogFileNames
();
}
protected
abstract
String
[]
getLogFileNames
();
protected
final
ClassLoader
getClassLoader
()
{
return
this
.
classLoader
;
...
...
@@ -56,14 +68,12 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
return
;
}
}
// Fallback to the non-prefixed value
initialize
(
getPackagedConfigFile
(
this
.
paths
[
this
.
paths
.
length
-
1
]
));
// Fallback to the non-prefixed value
taking into account file and console preferences
initialize
(
getPackagedConfigFile
(
addChannels
(
this
.
paths
[
this
.
paths
.
length
-
1
])
));
}
protected
void
initializeWithSensibleDefaults
()
{
String
path
=
this
.
paths
[
this
.
paths
.
length
-
1
];
path
=
path
.
replaceAll
(
"-console"
,
""
).
replaceAll
(
"-file"
,
""
);
initialize
(
getPackagedConfigFile
(
"basic-"
+
path
));
initialize
(
getPackagedConfigFile
(
"basic-"
+
this
.
paths
[
this
.
paths
.
length
-
1
]));
}
protected
final
String
getPackagedConfigFile
(
String
fileName
)
{
...
...
@@ -74,4 +84,14 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
return
defaultPath
;
}
private
String
addChannels
(
String
fileName
)
{
String
extension
=
"."
+
StringUtils
.
getFilenameExtension
(
fileName
);
return
fileName
.
replace
(
extension
,
getChannel
()
+
extension
);
}
private
String
getChannel
()
{
return
(
fileOutput
&&
consoleOutput
)
?
"-file-console"
:
(
fileOutput
?
"-file"
:
(
consoleOutput
?
""
:
"-none"
));
}
}
spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java
View file @
aec38566
...
...
@@ -51,27 +51,19 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
LEVELS
=
Collections
.
unmodifiableMap
(
levels
);
}
public
JavaLoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
super
(
classLoader
,
fileOutput
,
consoleOutput
);
public
JavaLoggingSystem
(
ClassLoader
classLoader
)
{
this
(
classLoader
,
false
,
true
);
}
@Override
protected
String
[]
getLogFileName
(
boolean
fileOutput
,
boolean
consoleOutput
)
{
if
(
fileOutput
&&
consoleOutput
)
{
return
new
String
[]
{
"logging-file-console.properties"
};
}
else
if
(
fileOutput
)
{
return
new
String
[]
{
"logging-file.properties"
};
}
else
if
(
consoleOutput
)
{
return
new
String
[]
{
"logging-console.properties"
};
}
else
{
return
new
String
[]
{
"logging.properties"
};
}
public
JavaLoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
super
(
classLoader
,
fileOutput
,
consoleOutput
);
}
@Override
protected
String
[]
getLogFileNames
()
{
return
new
String
[]
{
"logging.properties"
};
}
@Override
public
void
initialize
(
String
configLocation
)
{
...
...
spring-boot/src/main/java/org/springframework/boot/logging/log4j/Log4JLoggingSystem.java
View file @
aec38566
...
...
@@ -51,24 +51,18 @@ public class Log4JLoggingSystem extends Slf4JLoggingSystem {
LEVELS
=
Collections
.
unmodifiableMap
(
levels
);
}
public
Log4JLoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
super
(
classLoader
,
fileOutput
,
consoleOutput
);
public
Log4JLoggingSystem
(
ClassLoader
classLoader
)
{
this
(
classLoader
,
false
,
true
);
}
public
Log4JLoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
super
(
classLoader
,
fileOutput
,
consoleOutput
);
}
@Override
protected
String
[]
getLogFileName
(
boolean
fileOutput
,
boolean
consoleOutput
)
{
if
(
fileOutput
&&
consoleOutput
)
{
return
new
String
[]
{
"log4j-file-console.xml"
,
"log4j-file-console.properties"
};
}
else
if
(
fileOutput
)
{
return
new
String
[]
{
"log4j-file.xml"
,
"log4j-file.properties"
};
}
else
if
(
consoleOutput
)
{
return
new
String
[]
{
"log4j-console.xml"
,
"log4j-console.properties"
};
}
else
{
return
new
String
[]
{
"log4j.xml"
,
"log4j.properties"
};
}
protected
String
[]
getLogFileNames
()
{
return
new
String
[]
{
"log4j.xml"
,
"log4j.properties"
};
}
@Override
...
...
spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
View file @
aec38566
...
...
@@ -27,7 +27,6 @@ import org.apache.logging.log4j.core.LoggerContext;
import
org.apache.logging.log4j.core.config.Configuration
;
import
org.apache.logging.log4j.core.config.ConfigurationFactory
;
import
org.apache.logging.log4j.core.config.ConfigurationSource
;
import
org.springframework.boot.logging.LogLevel
;
import
org.springframework.boot.logging.LoggingSystem
;
import
org.springframework.boot.logging.Slf4JLoggingSystem
;
...
...
@@ -57,24 +56,17 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
LEVELS
=
Collections
.
unmodifiableMap
(
levels
);
}
public
Log4J2LoggingSystem
(
ClassLoader
classLoader
)
{
this
(
classLoader
,
false
,
true
);
}
public
Log4J2LoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
super
(
classLoader
,
fileOutput
,
consoleOutput
);
}
@Override
protected
String
[]
getLogFileName
(
boolean
fileOutput
,
boolean
consoleOutput
)
{
if
(
fileOutput
&&
consoleOutput
)
{
return
new
String
[]
{
"log4j2-file-console.json"
,
"log4j2-file-console.jsn"
,
"log4j2-file-console.xml"
};
}
else
if
(
fileOutput
)
{
return
new
String
[]
{
"log4j2-file.json"
,
"log4j2-file.jsn"
,
"log4j2-file.xml"
};
}
else
if
(
consoleOutput
)
{
return
new
String
[]
{
"log4j2-console.json"
,
"log4j2-console.jsn"
,
"log4j2-console.xml"
};
}
else
{
return
new
String
[]
{
"log4j2.json"
,
"log4j2.jsn"
,
"log4j2.xml"
};
}
protected
String
[]
getLogFileNames
()
{
return
new
String
[]
{
"log4j2.json"
,
"log4j2.jsn"
,
"log4j2.xml"
};
}
@Override
...
...
spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
View file @
aec38566
...
...
@@ -58,27 +58,19 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
LEVELS
=
Collections
.
unmodifiableMap
(
levels
);
}
public
LogbackLoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
super
(
classLoader
,
fileOutput
,
consoleOutput
);
public
LogbackLoggingSystem
(
ClassLoader
classLoader
)
{
this
(
classLoader
,
false
,
true
);
}
public
LogbackLoggingSystem
(
ClassLoader
classLoader
,
boolean
fileOutput
,
boolean
consoleOutput
)
{
super
(
classLoader
,
fileOutput
,
consoleOutput
);
}
@Override
protected
String
[]
getLogFileName
(
boolean
fileOutput
,
boolean
consoleOutput
)
{
if
(
fileOutput
&&
consoleOutput
)
{
return
new
String
[]
{
"logback-test-file-console.groovy"
,
"logback-test-file-console.xml"
,
"logback-file-console.groovy"
,
"logback-file-console.xml"
};
}
else
if
(
fileOutput
)
{
return
new
String
[]
{
"logback-test-file.groovy"
,
"logback-test-file.xml"
,
"logback-file.groovy"
,
"logback-file.xml"
};
}
else
if
(
consoleOutput
)
{
return
new
String
[]
{
"logback-test-console.groovy"
,
"logback-test-console.xml"
,
"logback-console.groovy"
,
"logback-console.xml"
};
}
else
{
return
new
String
[]
{
"logback-test.groovy"
,
"logback-test.xml"
,
"logback.groovy"
,
"logback.xml"
};
}
protected
String
[]
getLogFileNames
()
{
return
new
String
[]
{
"logback-test.groovy"
,
"logback-test.xml"
,
"logback.groovy"
,
"logback.xml"
};
}
@Override
...
...
spring-boot/src/main/resources/org/springframework/boot/logging/java/logging-
consol
e.properties
→
spring-boot/src/main/resources/org/springframework/boot/logging/java/logging-
non
e.properties
View file @
aec38566
handlers
=
java.util.logging.ConsoleHandler
handlers
=
.level
=
INFO
java.util.logging.ConsoleHandler.formatter
=
org.springframework.boot.logging.java.SimpleFormatter
java.util.logging.ConsoleHandler.level
=
ALL
org.hibernate.validator.internal.util.Version.level
=
WARNING
org.apache.coyote.http11.Http11NioProtocol.level
=
WARNING
org.crsh.plugin.level
=
WARNING
...
...
spring-boot/src/main/resources/org/springframework/boot/logging/java/logging.properties
View file @
aec38566
handlers
=
handlers
=
java.util.logging.ConsoleHandler
.level
=
INFO
java.util.logging.ConsoleHandler.formatter
=
org.springframework.boot.logging.java.SimpleFormatter
java.util.logging.ConsoleHandler.level
=
ALL
org.hibernate.validator.internal.util.Version.level
=
WARNING
org.apache.coyote.http11.Http11NioProtocol.level
=
WARNING
org.crsh.plugin.level
=
WARNING
...
...
spring-boot/src/main/resources/org/springframework/boot/logging/log4j/log4j-
consol
e.properties
→
spring-boot/src/main/resources/org/springframework/boot/logging/log4j/log4j-
non
e.properties
View file @
aec38566
log4j.rootCategory
=
INFO
, CONSOLE
log4j.rootCategory
=
INFO
PID
=
????
LOG_PATH
=
${java.io.tmpdir}
LOG_FILE
=
${LOG_PATH}/spring.log
LOG_PATTERN
=
[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${PID} %5p [%t] --- %c{1}: %m%n
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE
=
org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout
=
org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern
=
${LOG_PATTERN}
log4j.category.org.hibernate.validator.internal.util.Version
=
WARN
log4j.category.org.apache.coyote.http11.Http11NioProtocol
=
WARN
...
...
spring-boot/src/main/resources/org/springframework/boot/logging/log4j/log4j.properties
View file @
aec38566
log4j.rootCategory
=
INFO
log4j.rootCategory
=
INFO
, CONSOLE
PID
=
????
LOG_PATH
=
${java.io.tmpdir}
LOG_FILE
=
${LOG_PATH}/spring.log
LOG_PATTERN
=
[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${PID} %5p [%t] --- %c{1}: %m%n
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE
=
org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout
=
org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern
=
${LOG_PATTERN}
log4j.category.org.hibernate.validator.internal.util.Version
=
WARN
log4j.category.org.apache.coyote.http11.Http11NioProtocol
=
WARN
...
...
spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-
consol
e.xml
→
spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-
non
e.xml
View file @
aec38566
...
...
@@ -6,11 +6,6 @@
<Property
name=
"LOG_FILE"
>
${sys:LOG_PATH}/spring.log
</Property>
<Property
name=
"LOG_PATTERN"
>
[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n
</Property>
</Properties>
<Appenders>
<Console
name=
"Console"
target=
"SYSTEM_OUT"
follow=
"true"
>
<PatternLayout
pattern=
"${LOG_PATTERN}"
/>
</Console>
</Appenders>
<Loggers>
<Logger
name=
"org.hibernate.validator.internal.util.Version"
level=
"warn"
/>
<Logger
name=
"org.apache.coyote.http11.Http11NioProtocol"
level=
"warn"
/>
...
...
@@ -21,7 +16,6 @@
<Logger
name=
"org.eclipse.jetty.util.component.AbstractLifeCycle"
level=
"error"
/>
<Root
level=
"info"
>
<AppenderRef
ref=
"Console"
/>
</Root>
</Loggers>
</Configuration>
spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml
View file @
aec38566
...
...
@@ -6,6 +6,11 @@
<Property
name=
"LOG_FILE"
>
${sys:LOG_PATH}/spring.log
</Property>
<Property
name=
"LOG_PATTERN"
>
[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n
</Property>
</Properties>
<Appenders>
<Console
name=
"Console"
target=
"SYSTEM_OUT"
follow=
"true"
>
<PatternLayout
pattern=
"${LOG_PATTERN}"
/>
</Console>
</Appenders>
<Loggers>
<Logger
name=
"org.hibernate.validator.internal.util.Version"
level=
"warn"
/>
<Logger
name=
"org.apache.coyote.http11.Http11NioProtocol"
level=
"warn"
/>
...
...
@@ -16,6 +21,7 @@
<Logger
name=
"org.eclipse.jetty.util.component.AbstractLifeCycle"
level=
"error"
/>
<Root
level=
"info"
>
<AppenderRef
ref=
"Console"
/>
</Root>
</Loggers>
</Configuration>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/bas
ic
-file.xml
→
spring-boot/src/main/resources/org/springframework/boot/logging/logback/bas
e
-file.xml
View file @
aec38566
<?xml version="1.0" encoding="UTF8"?>
<?xml version="1.0" encoding="UTF
-
8"?>
<included>
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<property
name=
"LOG_FILE"
value=
"${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}"
/>
...
...
spring-boot/src/main/resources/org/springframework/boot/logging/logback/base.xml
View file @
aec38566
<?xml version="1.0" encoding="UTF-8"?>
<included>
<include
resource=
"org/springframework/boot/logging/logback/basic.xml"
/>
<conversionRule
conversionWord=
"clr"
converterClass=
"org.springframework.boot.logging.logback.ColorConverter"
/>
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t{14}]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
<charset>
utf8
</charset>
</encoder>
</appender>
<root
level=
"INFO"
>
</root
>
<appender-ref
ref=
"CONSOLE"
/
>
</root>
</included>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic-console.xml
deleted
100644 → 0
View file @
11c1e5ed
<?xml version="1.0" encoding="UTF8"?>
<included>
<conversionRule
conversionWord=
"clr"
converterClass=
"org.springframework.boot.logging.logback.ColorConverter"
/>
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t{14}]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex"
/>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
<charset>
utf8
</charset>
</encoder>
</appender>
<root
level=
"INFO"
>
<appender-ref
ref=
"CONSOLE"
/>
</root>
</included>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic-logback.xml
View file @
aec38566
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/bas
ic
.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/bas
e
.xml"
/>
</configuration>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic.xml
deleted
100644 → 0
View file @
11c1e5ed
<?xml version="1.0" encoding="UTF-8"?>
<included>
<appender
name=
"DEBUG_LEVEL_REMAPPER"
class=
"org.springframework.boot.logging.logback.LevelRemappingAppender"
>
<destinationLogger>
org.springframework.boot
</destinationLogger>
</appender>
<logger
name=
"org.hibernate.validator.internal.util.Version"
level=
"WARN"
/>
<logger
name=
"org.apache.coyote.http11.Http11NioProtocol"
level=
"WARN"
/>
<logger
name=
"org.crsh.plugin"
level=
"WARN"
/>
<logger
name=
"org.apache.tomcat.util.net.NioSelectorPool"
level=
"WARN"
/>
<logger
name=
"org.apache.catalina.startup.DigesterFactory"
level=
"ERROR"
/>
<logger
name=
"org.apache.catalina.util.LifecycleBase"
level=
"ERROR"
/>
<logger
name=
"org.eclipse.jetty.util.component.AbstractLifeCycle"
level=
"ERROR"
/>
<logger
name=
"org.thymeleaf"
additivity=
"false"
>
<appender-ref
ref=
"DEBUG_LEVEL_REMAPPER"
/>
</logger>
</included>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/logback-console.xml
deleted
100644 → 0
View file @
11c1e5ed
<?xml version="1.0" encoding="UTF8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/basic-console.xml"
/>
</configuration>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/logback-file-console.xml
View file @
aec38566
<?xml version="1.0" encoding="UTF8"?>
<?xml version="1.0" encoding="UTF
-
8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/basic-file.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/basic-console.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/base-file.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
</configuration>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/logback-file.xml
View file @
aec38566
<?xml version="1.0" encoding="UTF8"?>
<?xml version="1.0" encoding="UTF
-
8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/basic-file.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/base-file.xml"
/>
</configuration>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/logback-none.xml
0 → 100644
View file @
aec38566
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<root
level=
"INFO"
>
</root>
</configuration>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/logback.xml
View file @
aec38566
<?xml version="1.0" encoding="UTF8"?>
<?xml version="1.0" encoding="UTF
-
8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
</configuration>
spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java
View file @
aec38566
...
...
@@ -103,7 +103,18 @@ public class LoggingApplicationListenerTests {
String
output
=
this
.
outputCapture
.
toString
().
trim
();
assertTrue
(
"Wrong output:\n"
+
output
,
output
.
contains
(
"Hello world"
));
assertFalse
(
"Wrong output:\n"
+
output
,
output
.
contains
(
"???"
));
assertTrue
(
new
File
(
tmpDir
()
+
"/spring.log"
).
exists
());
assertFalse
(
new
File
(
tmpDir
()
+
"/spring.log"
).
exists
());
}
@Test
public
void
noConsole
()
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"logging.console: false"
);
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
this
.
context
.
getClassLoader
());
this
.
logger
.
info
(
"Hello world"
);
String
output
=
this
.
outputCapture
.
toString
().
trim
();
assertFalse
(
"Wrong output:\n"
+
output
,
output
.
contains
(
"Hello world"
));
assertFalse
(
new
File
(
tmpDir
()
+
"/spring.log"
).
exists
());
}
@Test
...
...
@@ -130,7 +141,7 @@ public class LoggingApplicationListenerTests {
String
output
=
this
.
outputCapture
.
toString
().
trim
();
assertTrue
(
"Wrong output:\n"
+
output
,
output
.
contains
(
"Hello world"
));
assertFalse
(
"Wrong output:\n"
+
output
,
output
.
contains
(
"???"
));
assert
Tru
e
(
new
File
(
tmpDir
()
+
"/spring.log"
).
exists
());
assert
Fals
e
(
new
File
(
tmpDir
()
+
"/spring.log"
).
exists
());
}
@Test
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment