mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-08 01:48:33 +08:00
Resource fix
Resource fix LOG4J2 PatternLayout debug change
This commit is contained in:
parent
c80205883f
commit
166b8362d3
@ -1,3 +1,4 @@
|
||||
package org.maxkey.crypto.jose.keystore;
|
||||
/*******************************************************************************
|
||||
* Copyright 2014 The MITRE Corporation
|
||||
* and the MIT Kerberos and Internet Trust Consortium
|
||||
@ -14,110 +15,111 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.maxkey.crypto.jose.keystore;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.nimbusds.jose.jwk.JWK;
|
||||
import com.nimbusds.jose.jwk.JWKSet;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* .
|
||||
* @author jricher
|
||||
*
|
||||
*/
|
||||
public class JWKSetKeyStore {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(JWKSetKeyStore.class);
|
||||
private JWKSet jwkSet;
|
||||
|
||||
private JWKSet jwkSet;
|
||||
private Resource location;
|
||||
|
||||
private Resource location;
|
||||
public JWKSetKeyStore() {
|
||||
|
||||
public JWKSetKeyStore() {
|
||||
}
|
||||
|
||||
}
|
||||
public JWKSetKeyStore(JWKSet jwkSet) {
|
||||
this.jwkSet = jwkSet;
|
||||
initializeJwkSet();
|
||||
}
|
||||
|
||||
public JWKSetKeyStore(JWKSet jwkSet) {
|
||||
this.jwkSet = jwkSet;
|
||||
initializeJwkSet();
|
||||
}
|
||||
private void initializeJwkSet() {
|
||||
|
||||
private void initializeJwkSet() {
|
||||
if (jwkSet == null) {
|
||||
if (location != null) {
|
||||
|
||||
if (jwkSet == null) {
|
||||
if (location != null) {
|
||||
if (location.exists() && location.isReadable()) {
|
||||
|
||||
if (location.exists() && location.isReadable()) {
|
||||
try {
|
||||
_logger.debug("JWK location " + location.getURL());
|
||||
// read in the file from disk
|
||||
String s = CharStreams
|
||||
.toString(new InputStreamReader(location.getInputStream(), Charsets.UTF_8));
|
||||
|
||||
try {
|
||||
// read in the file from disk
|
||||
String s = CharStreams.toString(new InputStreamReader(location.getInputStream(), Charsets.UTF_8));
|
||||
// parse it into a jwkSet object
|
||||
jwkSet = JWKSet.parse(s);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException("Key Set resource could not be read: " + location);
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException("Key Set resource could not be parsed: " + location);
|
||||
}
|
||||
|
||||
// parse it into a jwkSet object
|
||||
jwkSet = JWKSet.parse(s);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException("Key Set resource could not be read: " + location);
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException("Key Set resource could not be parsed: " + location); }
|
||||
} else {
|
||||
throw new IllegalArgumentException("Key Set resource could not be read: " + location);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new IllegalArgumentException("Key Set resource could not be read: " + location);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Key store must be initialized with at least one of a jwkSet or a location.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new IllegalArgumentException("Key store must be initialized with at least one of a jwkSet or a location.");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return the jwkSet
|
||||
*/
|
||||
public JWKSet getJwkSet() {
|
||||
return jwkSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the jwkSet
|
||||
*/
|
||||
public JWKSet getJwkSet() {
|
||||
return jwkSet;
|
||||
}
|
||||
/**
|
||||
* @param jwkSet the jwkSet to set
|
||||
*/
|
||||
public void setJwkSet(JWKSet jwkSet) {
|
||||
this.jwkSet = jwkSet;
|
||||
initializeJwkSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jwkSet the jwkSet to set
|
||||
*/
|
||||
public void setJwkSet(JWKSet jwkSet) {
|
||||
this.jwkSet = jwkSet;
|
||||
initializeJwkSet();
|
||||
}
|
||||
/**
|
||||
* @return the location
|
||||
*/
|
||||
public Resource getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location
|
||||
*/
|
||||
public Resource getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param location the location to set
|
||||
*/
|
||||
public void setLocation(Resource location) {
|
||||
this.location = location;
|
||||
initializeJwkSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of keys in this keystore. This is a passthrough to the underlying JWK Set
|
||||
*/
|
||||
public List<JWK> getKeys() {
|
||||
if (jwkSet == null) {
|
||||
initializeJwkSet();
|
||||
}
|
||||
return jwkSet.getKeys();
|
||||
}
|
||||
/**
|
||||
* @param location the location to set
|
||||
*/
|
||||
public void setLocation(Resource location) {
|
||||
this.location = location;
|
||||
|
||||
initializeJwkSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of keys in this keystore. This is a passthrough to the
|
||||
* underlying JWK Set
|
||||
*/
|
||||
public List<JWK> getKeys() {
|
||||
if (jwkSet == null) {
|
||||
initializeJwkSet();
|
||||
}
|
||||
return jwkSet.getKeys();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,105 +1,105 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
package org.maxkey.crypto.keystore;
|
||||
|
||||
import java.security.KeyStore;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
|
||||
/**
|
||||
* .
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
public class KeyStoreLoader implements InitializingBean{
|
||||
private final static Logger _logger = LoggerFactory.getLogger(KeyStoreLoader.class);
|
||||
public class KeyStoreLoader implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(KeyStoreLoader.class);
|
||||
|
||||
private KeyStore keyStore;
|
||||
private KeyStore keyStore;
|
||||
|
||||
private String entityName;
|
||||
private String keystoreFile;
|
||||
private String keystorePassword;
|
||||
private String entityName;
|
||||
private Resource keystoreFile;
|
||||
private String keystorePassword;
|
||||
|
||||
private String keystoreType = "JKS";
|
||||
private String keystoreType = "JKS";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public KeyStoreLoader() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public KeyStoreLoader() {
|
||||
}
|
||||
/**
|
||||
* @return the keyStore
|
||||
*/
|
||||
public KeyStore getKeyStore() {
|
||||
return keyStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the keyStore
|
||||
*/
|
||||
public KeyStore getKeyStore() {
|
||||
return keyStore;
|
||||
}
|
||||
/**
|
||||
* @param keystoreFile the keystoreFile to set
|
||||
*/
|
||||
public void setKeystoreFile(Resource keystoreFile) {
|
||||
this.keystoreFile = keystoreFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keystoreFile the keystoreFile to set
|
||||
*/
|
||||
public void setKeystoreFile(String keystoreFile) {
|
||||
this.keystoreFile = keystoreFile;
|
||||
}
|
||||
/**
|
||||
* @param keystorePassword the keystorePassword to set
|
||||
*/
|
||||
public void setKeystorePassword(String keystorePassword) {
|
||||
this.keystorePassword = keystorePassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD>ȡKeyStore<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getKeystorePassword() {
|
||||
return keystorePassword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
_logger.debug("Load KeyStore from file " + keystoreFile.getURL());
|
||||
keyStore = KeyStoreUtil.loadKeyStore(
|
||||
keystoreFile, keystorePassword.toCharArray(),
|
||||
KeyStoreType.JKS);
|
||||
_logger.debug("Load KeyStore success . ");
|
||||
|
||||
/**
|
||||
* @param keystorePassword the keystorePassword to set
|
||||
*/
|
||||
public void setKeystorePassword(String keystorePassword) {
|
||||
this.keystorePassword = keystorePassword;
|
||||
}
|
||||
Enumeration<String> temp = keyStore.aliases();
|
||||
int i = 0;
|
||||
while (temp.hasMoreElements()) {
|
||||
_logger.debug("KeyStore alias name " + (i++) + " : " + temp.nextElement());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD>ȡKeyStore<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* @return
|
||||
*/
|
||||
public String getKeystorePassword() {
|
||||
return keystorePassword;
|
||||
}
|
||||
/**
|
||||
* .
|
||||
* @return the entityName
|
||||
*/
|
||||
public String getEntityName() {
|
||||
return entityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
_logger.debug("Load KeyStore from file "+ResourceUtils.getFile(keystoreFile).getPath());
|
||||
keyStore =KeyStoreUtil.loadKeyStore(ResourceUtils.getFile(keystoreFile), keystorePassword.toCharArray(), KeyStoreType.JKS);
|
||||
_logger.debug("Load KeyStore success . ");
|
||||
|
||||
Enumeration<String> temp = keyStore.aliases();
|
||||
int i=0;
|
||||
while(temp.hasMoreElements()){
|
||||
_logger.debug("KeyStore alias name "+(i++)+" : "+temp.nextElement());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the entityName
|
||||
*/
|
||||
public String getEntityName() {
|
||||
return entityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entityName the entityName to set
|
||||
*/
|
||||
public void setEntityName(String entityName) {
|
||||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the keystoreType
|
||||
*/
|
||||
public String getKeystoreType() {
|
||||
return keystoreType;
|
||||
}
|
||||
/**
|
||||
* @param entityName the entityName to set
|
||||
*/
|
||||
public void setEntityName(String entityName) {
|
||||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the keystoreType
|
||||
*/
|
||||
public String getKeystoreType() {
|
||||
return keystoreType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@ public class ConfigurerFreeMarker implements ApplicationContextAware {
|
||||
Map<String, Object> map = this.applicationContext.getBeansWithAnnotation(FreemarkerTag.class);
|
||||
for (String key : map.keySet()) {
|
||||
configuration.setSharedVariable(key, map.get(key));
|
||||
_logger.debug("FreeMarker Template "+key);
|
||||
_logger.trace("FreeMarker Template "+key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -60,7 +60,8 @@ public class InitApplicationContext extends HttpServlet {
|
||||
* InitApplicationContext.
|
||||
*/
|
||||
public InitApplicationContext() {
|
||||
this.applicationContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
|
||||
this.applicationContext =
|
||||
WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
|
||||
}
|
||||
|
||||
public InitApplicationContext(ConfigurableApplicationContext applicationContext) {
|
||||
@ -71,20 +72,19 @@ public class InitApplicationContext extends HttpServlet {
|
||||
* loadCaches.
|
||||
*/
|
||||
public void loadCaches() {
|
||||
_logger.info(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.info("-----------------------------------------------------------");
|
||||
_logger.info("Load Caches ");
|
||||
|
||||
try {
|
||||
if (applicationContext.containsBean("cacheFactory")) {
|
||||
CacheFactory cacheFactory = applicationContext.getBean("cacheFactory", CacheFactory.class);
|
||||
CacheFactory cacheFactory =
|
||||
applicationContext.getBean("cacheFactory", CacheFactory.class);
|
||||
cacheFactory.start();
|
||||
}
|
||||
} catch (BeansException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
_logger.info(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.info("-----------------------------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
@ -94,30 +94,42 @@ public class InitApplicationContext extends HttpServlet {
|
||||
public void listDataBaseVariables() {
|
||||
if (applicationContext.containsBean("dataSource")) {
|
||||
try {
|
||||
_logger.debug(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.debug("-----------------------------------------------------------");
|
||||
_logger.debug("List DatabaseMetaData Variables ");
|
||||
Connection connection = ((javax.sql.DataSource) applicationContext.getBean("dataSource"))
|
||||
Connection connection =
|
||||
((javax.sql.DataSource) applicationContext.getBean("dataSource"))
|
||||
.getConnection();
|
||||
|
||||
java.sql.DatabaseMetaData databaseMetaData = connection.getMetaData();
|
||||
_logger.debug("DatabaseProductName : " + databaseMetaData.getDatabaseProductName());
|
||||
_logger.debug("DatabaseProductVersion: " + databaseMetaData.getDatabaseProductVersion());
|
||||
_logger.debug("DatabaseMajorVersion : " + databaseMetaData.getDatabaseMajorVersion());
|
||||
_logger.debug("DatabaseMinorVersion : " + databaseMetaData.getDatabaseMinorVersion());
|
||||
_logger.debug("supportsTransactions : " + databaseMetaData.supportsTransactions());
|
||||
_logger.debug("DefaultTransaction : " + databaseMetaData.getDefaultTransactionIsolation());
|
||||
_logger.debug("MaxConnections : " + databaseMetaData.getMaxConnections());
|
||||
_logger.debug("DatabaseProductName : "
|
||||
+ databaseMetaData.getDatabaseProductName());
|
||||
_logger.debug("DatabaseProductVersion: "
|
||||
+ databaseMetaData.getDatabaseProductVersion());
|
||||
_logger.debug("DatabaseMajorVersion : "
|
||||
+ databaseMetaData.getDatabaseMajorVersion());
|
||||
_logger.debug("DatabaseMinorVersion : "
|
||||
+ databaseMetaData.getDatabaseMinorVersion());
|
||||
_logger.debug("supportsTransactions : "
|
||||
+ databaseMetaData.supportsTransactions());
|
||||
_logger.debug("DefaultTransaction : "
|
||||
+ databaseMetaData.getDefaultTransactionIsolation());
|
||||
_logger.debug("MaxConnections : "
|
||||
+ databaseMetaData.getMaxConnections());
|
||||
_logger.debug("");
|
||||
_logger.debug("JDBCMajorVersion : " + databaseMetaData.getJDBCMajorVersion());
|
||||
_logger.debug("JDBCMinorVersion : " + databaseMetaData.getJDBCMinorVersion());
|
||||
_logger.debug("DriverName : " + databaseMetaData.getDriverName());
|
||||
_logger.debug("DriverVersion : " + databaseMetaData.getDriverVersion());
|
||||
_logger.debug("JDBCMajorVersion : "
|
||||
+ databaseMetaData.getJDBCMajorVersion());
|
||||
_logger.debug("JDBCMinorVersion : "
|
||||
+ databaseMetaData.getJDBCMinorVersion());
|
||||
_logger.debug("DriverName : "
|
||||
+ databaseMetaData.getDriverName());
|
||||
_logger.debug("DriverVersion : "
|
||||
+ databaseMetaData.getDriverVersion());
|
||||
_logger.debug("");
|
||||
_logger.debug("DBMS URL : " + databaseMetaData.getURL());
|
||||
_logger.debug("UserName : " + databaseMetaData.getUserName());
|
||||
_logger.debug(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.debug("DBMS URL : "
|
||||
+ databaseMetaData.getURL());
|
||||
_logger.debug("UserName : "
|
||||
+ databaseMetaData.getUserName());
|
||||
_logger.debug("-----------------------------------------------------------");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -129,13 +141,15 @@ public class InitApplicationContext extends HttpServlet {
|
||||
*/
|
||||
public void listProperties() {
|
||||
if (applicationContext.containsBean("propertySourcesPlaceholderConfigurer")) {
|
||||
_logger.debug(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.debug("List Properties Variables ");
|
||||
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = ((PropertySourcesPlaceholderConfigurer) applicationContext
|
||||
_logger.trace("-----------------------------------------------------------");
|
||||
_logger.trace("List Properties Variables ");
|
||||
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer =
|
||||
((PropertySourcesPlaceholderConfigurer) applicationContext
|
||||
.getBean("propertySourcesPlaceholderConfigurer"));
|
||||
properties = (Properties) propertySourcesPlaceholderConfigurer.getAppliedPropertySources()
|
||||
.get(PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME).getSource();
|
||||
properties = (Properties) propertySourcesPlaceholderConfigurer
|
||||
.getAppliedPropertySources()
|
||||
.get(PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME)
|
||||
.getSource();
|
||||
Set<Object> keyValue = properties.keySet();
|
||||
SortedSet<String> keyValueSet = new TreeSet<String>();
|
||||
// sort key
|
||||
@ -146,10 +160,9 @@ public class InitApplicationContext extends HttpServlet {
|
||||
// out
|
||||
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();) {
|
||||
String key = (String) it.next();
|
||||
_logger.debug(key + " = " + properties.get(key));
|
||||
_logger.trace(key + " = " + properties.get(key));
|
||||
}
|
||||
_logger.debug(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.trace("-----------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,8 +170,7 @@ public class InitApplicationContext extends HttpServlet {
|
||||
* listEnvVars.
|
||||
*/
|
||||
public void listEnvVars() {
|
||||
_logger.debug(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.debug("-----------------------------------------------------------");
|
||||
_logger.debug("List Environment Variables ");
|
||||
Map<String, String> map = System.getenv();
|
||||
SortedSet<String> keyValueSet = new TreeSet<String>();
|
||||
@ -169,27 +181,25 @@ public class InitApplicationContext extends HttpServlet {
|
||||
// out
|
||||
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();) {
|
||||
String key = (String) it.next();
|
||||
_logger.debug(key + " = " + map.get(key));
|
||||
_logger.trace(key + " = " + map.get(key));
|
||||
}
|
||||
_logger.debug("APP_HOME" + " = " + PathUtils.getInstance().getAppPath());
|
||||
_logger.debug(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.debug("-----------------------------------------------------------");
|
||||
}
|
||||
|
||||
/**
|
||||
* showLicense.
|
||||
*/
|
||||
public void showLicense() {
|
||||
_logger.info(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.info("-----------------------------------------------------------");
|
||||
_logger.info("+ Single Sign On ( SSO ) ");
|
||||
_logger.info("+ MaxKey Version "+properties.getProperty("application.formatted-version"));
|
||||
_logger.info("+ MaxKey Version "
|
||||
+ properties.getProperty("application.formatted-version"));
|
||||
_logger.info("");
|
||||
_logger.info("+ Apache License 2.0");
|
||||
_logger.info("+ https://shimingxy.github.io/MaxKey/");
|
||||
_logger.info("+ email:shimingxy@163.com");
|
||||
_logger.info(
|
||||
"----------------------------------------------------------------------------------------------------");
|
||||
_logger.info("-----------------------------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ import org.opensaml.saml2.metadata.impl.SurNameBuilder;
|
||||
import org.opensaml.saml2.metadata.impl.TelephoneNumberBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
|
||||
import java.security.KeyStore;
|
||||
|
||||
@ -118,7 +119,7 @@ public void samlmtest(){
|
||||
try {
|
||||
KeyStoreLoader keyStoreLoader=new KeyStoreLoader();
|
||||
keyStoreLoader.setKeystorePassword("secret");
|
||||
keyStoreLoader.setKeystoreFile("D:/JavaIDE/cert/idp-keystore.jks");
|
||||
keyStoreLoader.setKeystoreFile(new FileSystemResource("D:/JavaIDE/cert/idp-keystore.jks"));
|
||||
keyStoreLoader.afterPropertiesSet();
|
||||
KeyStore trustKeyStore =keyStoreLoader.getKeyStore();
|
||||
|
||||
|
||||
@ -6,14 +6,14 @@
|
||||
<appenders>
|
||||
|
||||
<Console name="consolePrint" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} [%t] %-5level %logger{36} - %msg%n" />
|
||||
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} %-5level [%t] %logger{36}:%L - %msg%n" />
|
||||
</Console>
|
||||
|
||||
<!-- 输出到文件,按天或者超过128MB分割 -->
|
||||
<RollingFile name="RollingFile" fileName="logs/maxkey_mgt.log" filePattern="logs/$${date:yyyyMMdd}/maxkey-%d{yyyy-MM-dd}-%i.log.gz">
|
||||
<!-- 需要记录的级别 -->
|
||||
<!-- <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" /> -->
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%F:%L) - %m%n" />
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5level [%t] (%logger{36}:%L) - %msg%n" />
|
||||
<Policies>
|
||||
<OnStartupTriggeringPolicy />
|
||||
<TimeBasedTriggeringPolicy />
|
||||
|
||||
@ -6,14 +6,14 @@
|
||||
<appenders>
|
||||
|
||||
<Console name="consolePrint" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} [%t] %-5level %logger{36} - %msg%n" />
|
||||
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} %-5level [%t] %logger{36}:%L - %msg%n" />
|
||||
</Console>
|
||||
|
||||
<!-- 输出到文件,按天或者超过128MB分割 每天进行归档yyyy-MM-dd -->
|
||||
<RollingFile name="RollingFile" fileName="logs/maxkey.log" filePattern="logs/$${date:yyyyMMdd}/maxkey-%d{yyyy-MM-dd}-%i.log.gz">
|
||||
<!-- 需要记录的级别 -->
|
||||
<!-- <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" /> -->
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%F:%L) - %m%n" />
|
||||
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} %-5level [%t] %logger{36}:%L - %msg%n" />
|
||||
<Policies>
|
||||
<OnStartupTriggeringPolicy />
|
||||
<TimeBasedTriggeringPolicy />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user