Java 类org.springframework.boot.ApplicationPid 实例源码
项目:https-github.com-g0t4-jenkins2-course-spring-boot
文件:LoggingSystemProperties.java
public void apply(LogFile logFile) {
RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(
this.environment, "logging.");
setSystemProperty(propertyResolver, EXCEPTION_CONVERSION_WORD,
"exception-conversion-word");
setSystemProperty(propertyResolver, CONSOLE_LOG_PATTERN, "pattern.console");
setSystemProperty(propertyResolver, FILE_LOG_PATTERN, "pattern.file");
setSystemProperty(propertyResolver, LOG_LEVEL_PATTERN, "pattern.level");
setSystemProperty(PID_KEY, new ApplicationPid().toString());
if (logFile != null) {
logFile.applyToSystemProperties();
}
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot
文件:LoggingApplicationListenerTests.java
@Test
public void logFilePropertiesCanReferenceSystemProperties() {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
"logging.file=target/${PID}.log");
this.initializer.initialize(this.context.getEnvironment(),
this.context.getClassLoader());
assertThat(System.getProperty("LOG_FILE"))
.isEqualTo("target/" + new ApplicationPid().toString() + ".log");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot
文件:ApplicationPidFileWriter.java
private void writePidFile(SpringApplicationEvent event) throws IOException {
File pidFile = this.file;
String override = getProperty(event, FILE_PROPERTIES);
if (override != null) {
pidFile = new File(override);
}
new ApplicationPid().write(pidFile);
pidFile.deleteOnExit();
}
项目:spring-boot-concourse
文件:LoggingSystemProperties.java
public void apply(LogFile logFile) {
RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(
this.environment, "logging.");
setSystemProperty(propertyResolver, EXCEPTION_CONVERSION_WORD,
"exception-conversion-word");
setSystemProperty(propertyResolver, CONSOLE_LOG_PATTERN, "pattern.console");
setSystemProperty(propertyResolver, FILE_LOG_PATTERN, "pattern.file");
setSystemProperty(propertyResolver, LOG_LEVEL_PATTERN, "pattern.level");
setSystemProperty(PID_KEY, new ApplicationPid().toString());
if (logFile != null) {
logFile.applyToSystemProperties();
}
}
项目:spring-boot-concourse
文件:LoggingApplicationListenerTests.java
@Test
public void logFilePropertiesCanReferenceSystemProperties() {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
"logging.file=target/${PID}.log");
this.initializer.initialize(this.context.getEnvironment(),
this.context.getClassLoader());
assertThat(System.getProperty("LOG_FILE"))
.isEqualTo("target/" + new ApplicationPid().toString() + ".log");
}
项目:spring-boot-concourse
文件:ApplicationPidFileWriter.java
private void writePidFile(SpringApplicationEvent event) throws IOException {
File pidFile = this.file;
String override = getProperty(event, FILE_PROPERTIES);
if (override != null) {
pidFile = new File(override);
}
new ApplicationPid().write(pidFile);
pidFile.deleteOnExit();
}
项目:contestparser
文件:LoggingApplicationListener.java
/**
* Initialize the logging system according to preferences expressed through the
* {@link Environment} and the classpath.
* @param environment the environment
* @param classLoader the classloader
*/
protected void initialize(ConfigurableEnvironment environment,
ClassLoader classLoader) {
if (System.getProperty(PID_KEY) == null) {
System.setProperty(PID_KEY, new ApplicationPid().toString());
}
if (System.getProperty(EXCEPTION_CONVERSION_WORD) == null) {
System.setProperty(EXCEPTION_CONVERSION_WORD,
getExceptionConversionWord(environment));
}
initializeEarlyLoggingLevel(environment);
initializeSystem(environment, this.loggingSystem);
initializeFinalLoggingLevels(environment, this.loggingSystem);
registerShutdownHookIfNecessary(environment, this.loggingSystem);
}
项目:contestparser
文件:ApplicationPidFileWriter.java
private void writePidFile(SpringApplicationEvent event) throws IOException {
File pidFile = this.file;
String override = getProperty(event, FILE_PROPERTIES);
if (override != null) {
pidFile = new File(override);
}
new ApplicationPid().write(pidFile);
pidFile.deleteOnExit();
}