-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0072382
commit d68cd3e
Showing
2 changed files
with
98 additions
and
112 deletions.
There are no files selected for viewing
209 changes: 98 additions & 111 deletions
209
src/main/java/org/summerboot/jexpress/boot/BootConstant.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 |
---|---|---|
@@ -1,116 +1,103 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- version 2.4.10 --> | ||
<Configuration status="WARN" monitorInterval="30"> | ||
<Properties> | ||
<Property name="logPattern" value="[${sys:logId}] %d{ISO8601} %p %c{}.%M() [%t] %m %ex%n"/> | ||
<!-- usage: %replace{pattern}{regex}{substitution} --> | ||
<Property name="logPattern2" value="[${sys:logId}] %d{ISO8601} %p %c{}.%M() [%t] %replace{%enc{%m}{CRLF}}{\\r|\\n|%0D|%0A|%0d|%0a}{|} %uEx%n"/> | ||
</Properties> | ||
<Appenders> | ||
<Console name="Console" target="SYSTEM_OUT"> | ||
<!-- <PatternLayout pattern="%d{ISO8601}{Canada/Eastern} %p %c{}.%M() [%t] %enc{%m}{CRLF} %ex%n"/>--> | ||
<PatternLayout pattern="${sys:logPattern}"/> | ||
</Console> | ||
/* | ||
* Copyright 2005-2022 Du Law Office - The Summer Boot Framework Project | ||
* | ||
* The Summer Boot Project licenses this file to you under the Apache License, version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License and you have no | ||
* policy prohibiting employee contributions back to this file (unless the contributor to this | ||
* file is your current or retired employee). You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package org.summerboot.jexpress.boot; | ||
|
||
<!-- | ||
1. Requires JVM arg: -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector | ||
2. Required total disk spece: around 200MB | ||
3. Archive logs: by DAY and split them by MINUTE | ||
4. Default log level is tuned for development | ||
--> | ||
<RollingRandomAccessFile | ||
name="StatusLogFile" | ||
fileName="${sys:logPath}/${sys:appName}_status_${sys:serverName}.log" | ||
filePattern="${sys:logPath}/$${date:yyyy-MM-dd}/${sys:appName}_status_${sys:serverName}_%d{yyyy-MM-dd HH:mm}.%i.log.gz" | ||
immediateFlush="false" | ||
ignoreExceptions="false"> | ||
<PatternLayout pattern="${sys:logPattern}"/> | ||
<Policies> | ||
<SizeBasedTriggeringPolicy size="2MB"/> | ||
</Policies> | ||
<DefaultRolloverStrategy max="50"/> | ||
</RollingRandomAccessFile> | ||
<RollingRandomAccessFile | ||
name="RequestLogFile" | ||
fileName="${sys:logPath}/${sys:appName}_requests_${sys:serverName}.log" | ||
filePattern="${sys:logPath}/$${date:yyyy-MM-dd}/${sys:appName}_requests_${sys:serverName}_%d{yyyy-MM-dd HH:mm}.%i.log.gz" | ||
immediateFlush="false" | ||
ignoreExceptions="false"> | ||
<PatternLayout pattern="${sys:logPattern}"/> | ||
<Policies> | ||
<SizeBasedTriggeringPolicy size="10MB"/> | ||
</Policies> | ||
<DefaultRolloverStrategy max="500"/> | ||
</RollingRandomAccessFile> | ||
<RollingRandomAccessFile | ||
name="ScheduledLogFile" | ||
fileName="${sys:logPath}/${sys:appName}_schedule_${sys:serverName}.log" | ||
filePattern="${sys:logPath}/$${date:yyyy-MM-dd}/${sys:appName}_schedule_${sys:serverName}_%d{yyyy-MM-dd HH:mm}.%i.log.gz" | ||
immediateFlush="false" | ||
ignoreExceptions="false"> | ||
<PatternLayout pattern="${sys:logPattern}"/> | ||
<Policies> | ||
<SizeBasedTriggeringPolicy size="10MB"/> | ||
</Policies> | ||
<DefaultRolloverStrategy max="500"/> | ||
</RollingRandomAccessFile> | ||
</Appenders> | ||
<Loggers> | ||
<Root level="warn" includeLocation="true"> | ||
<AppenderRef ref="StatusLogFile"/> | ||
<!-- --> | ||
<AppenderRef ref="Console"/> | ||
</Root> | ||
<Logger level="info" name="com.hazelcast" includeLocation="true"/> | ||
<Logger level="warn" name="io.netty" includeLocation="true"/> | ||
<!-- Note: "java.lang.UnsupportedOperationException: sun.misc.Unsafe unavailable" can be seen, also can be ignored, when -Dio.netty.noUnsafe=true and io.netty.util.internal.CleanerJava9 log level is below INFO (either TRACE or DEBUG) --> | ||
<Logger level="info" name="io.netty.util.internal.CleanerJava9" includeLocation="true"/> | ||
<Logger level="debug" name="org.summerboot.jexpress.boot" includeLocation="true"/> | ||
<Logger level="warn" org.summerboot.jexpress.boot.instrumentation.Timeout includeLocation="true"/> | ||
<Logger level="info" name="org.summerboot.jexpress.integration.httpclient.HttpClientConfig" includeLocation="true"/> | ||
<Logger level="info" name="org.summerboot.jexpress.nio.server.NioServerHttpInitializer" includeLocation="true"/> | ||
<Logger level="debug" name="org.summerboot.jexpress.nio.server.NioServer" includeLocation="true"/> | ||
<Logger level="debug" name="org.summerboot.jexpress.nio.grpc.GRPCServer" includeLocation="true"/> | ||
import java.util.Random; | ||
|
||
/** | ||
* @author Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵 | ||
*/ | ||
public interface BootConstant { | ||
|
||
<Logger level="warn" name="io.netty.handler" includeLocation="false" additivity="false"> | ||
<AppenderRef ref="RequestLogFile"/> | ||
<!-- --> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
String APP_ID = String.format("%06d", new Random().nextInt(999999)); | ||
|
||
<Logger level="info" name="org.summerboot.jexpress.nio.server.BootHttpRequestHandler" includeLocation="false" | ||
additivity="false"> | ||
<AppenderRef ref="RequestLogFile"/> | ||
<!-- --> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
<Logger level="info" name="org.summerboot.jexpress.integration.quartz.BootJobListener" includeLocation="false" | ||
additivity="false"> | ||
<AppenderRef ref="ScheduledLogFile"/> | ||
<!-- --> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
<Logger level="warn" name="org.summerboot.jexpress.integration.ldap" includeLocation="true" additivity="false"> | ||
<AppenderRef ref="RequestLogFile"/> | ||
<!-- --> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
<Logger level="debug" name="org.hibernate.SQL" includeLocation="true" additivity="false"> | ||
<AppenderRef ref="RequestLogFile"/> | ||
<!-- --> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
<Logger level="debug" name="org.hibernate.type" includeLocation="true" additivity="false"> | ||
<AppenderRef ref="RequestLogFile"/> | ||
<!-- --> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
//version | ||
String VERSION = "SummerBoot.jExpress 2.4.10"; | ||
String JEXPRESS_PACKAGE_NAME = "org.summerboot.jexpress"; | ||
|
||
<Logger level="debug" name="${sys:appPackageName}" includeLocation="true" additivity="false"> | ||
<AppenderRef ref="RequestLogFile"/> | ||
<!-- --> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
</Loggers> | ||
</Configuration> | ||
String DEFAULT_ADMIN_MM = "changeit"; | ||
|
||
/* | ||
* Runtime info | ||
*/ | ||
int CPU_CORE = Runtime.getRuntime().availableProcessors(); | ||
String PID = java.lang.management.ManagementFactory.getRuntimeMXBean().getName(); | ||
String BR = System.lineSeparator(); | ||
|
||
//logging metadata | ||
String LOG4J2_KEY = "log4j.configurationFile"; | ||
String LOG4J2_JDKADAPTER_KEY = "java.util.logging.manager"; | ||
String LOG4J2_JDKADAPTER_VALUE = "org.apache.logging.log4j.jul.LogManager"; | ||
|
||
/** | ||
* 3. jExpress Default Settings | ||
*/ | ||
boolean CFG_ERROR_CODE_AS_INT = BackOffice.agent.isErrorCodeAsInt(); | ||
int CFG_CHANGE_MONITOR_INTERVAL_SEC = BackOffice.agent.getCfgChangeMonitorIntervalSec(); | ||
int PACKAGE_LEVEL = BackOffice.agent.getReflectionPackageLevel(); | ||
long WEB_RESOURCE_TTL_MS = BackOffice.agent.getWebResourceCacheTtlSec() * 1000; | ||
String DIR_STANDALONE = BackOffice.agent.getDomainFolderPrefix(); | ||
String DIR_CONFIGURATION = BackOffice.agent.getConfigFolderName(); | ||
String DIR_PLUGIN = BackOffice.agent.getPluginFolderName(); | ||
String DIR_LOG = BackOffice.agent.getLogFolderName(); | ||
|
||
String FILE_CFG_AUTH = BackOffice.agent.getAuthConfigFileName(); | ||
String FILE_CFG_SMTP = BackOffice.agent.getSmtpConfigFileName(); | ||
String FILE_CFG_NIO = BackOffice.agent.getNioConfigFileName(); | ||
String FILE_CFG_GRPC = BackOffice.agent.getgRPCConfigFileName(); | ||
|
||
String RESPONSE_HEADER_KEY_REF = "X-Reference"; | ||
String RESPONSE_HEADER_KEY_TS = "X-ServerTs"; | ||
|
||
String PAUSE_LOCK_CODE_VIAFILE = BackOffice.agent.getPauseLockCodeViaFile(); | ||
String PAUSE_LOCK_CODE_VIAWEB = BackOffice.agent.getPauseLockCodeViaWeb(); | ||
|
||
|
||
/* | ||
* 4. jExpress Default CLI Name | ||
*/ | ||
String CLI_USAGE = BackOffice.agent.getCliName_usage(); | ||
String CLI_VERSION = BackOffice.agent.getCliName_version(); | ||
String CLI_CONFIG_DOMAIN = BackOffice.agent.getCliName_domain(); | ||
String CLI_CONFIG_DIR = BackOffice.agent.getCliName_cfgdir(); | ||
String CLI_CONFIG_MONITOR_INTERVAL = BackOffice.agent.getCliName_monitorInterval(); | ||
String CLI_I8N = BackOffice.agent.getCliName_i18n(); | ||
String CLI_USE_IMPL = BackOffice.agent.getCliName_use();//To specify which implementation will be used via @Component.checkImplTagUsed | ||
String CLI_CONFIG_DEMO = BackOffice.agent.getCliName_cfgdemo(); | ||
String CLI_LIST_UNIQUE = BackOffice.agent.getCliName_list(); | ||
String CLI_ADMIN_PWD_FILE = BackOffice.agent.getCliName_authfile(); | ||
String CLI_ADMIN_PWD = BackOffice.agent.getCliName_auth(); | ||
String CLI_JWT = BackOffice.agent.getCliName_jwt(); | ||
String CLI_ENCRYPT = BackOffice.agent.getCliName_encrypt(); | ||
String CLI_DECRYPT = BackOffice.agent.getCliName_decrypt(); | ||
String CLI_PSV = BackOffice.agent.getCliName_psv(); | ||
String MEMO_DELIMITER = BackOffice.agent.getMemoDelimiter(); | ||
|
||
/* | ||
* 5. Log4j2.xml variables | ||
* | ||
* Pass by System.setProperty() instead of making them public static, any better idea? | ||
* ‘java.lang.System.getProperty()’ API underlyingly uses ‘java.util.Hashtable.get()’ API. | ||
* Please be advised that ‘java.util.Hashtable.get()’ is a synchronized API. | ||
* It means only one thread can invoke the ‘java.util.Hashtable.get()’ method at any given time. | ||
*/ | ||
String SYS_PROP_LOGID = BackOffice.agent.getLog4J2LogId();// "logid" // used by log4j2.xml ${sys:logid} | ||
String SYS_PROP_LOGFILEPATH = BackOffice.agent.getLog4j2LogFilePath();//"logPath"; // used by log4j2.xml ${sys:loggingPath} | ||
String SYS_PROP_LOGFILENAME = BackOffice.agent.getLog4j2LogFileName();//"appName"; // used by log4j2.xml ${sys:appappName} as log file name | ||
String SYS_PROP_SERVER_NAME = BackOffice.agent.getLog4j2ServerName();//"serverName"; // used by log4j2.xml ${hostName} | ||
String SYS_PROP_APP_PACKAGE_NAME = BackOffice.agent.getLog4j2AppPackageName();//"appPackageName"; // used by both log4j2.xml ${sys:appPackage} and JPAHibernateConfig to scan @Entity | ||
|
||
} |
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