001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.core;
015
016import java.nio.charset.Charset;
017import java.nio.charset.StandardCharsets;
018
019public class CoreConstants {
020
021    final public static String DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY = "logbackDisableServletContainerInitializer";
022    final public static String STATUS_LISTENER_CLASS_KEY = "logback.statusListenerClass";
023    final public static String SYSOUT = "SYSOUT";
024
025    final public static String STDOUT = "STDOUT";
026
027    /**
028     * Number of idle threads to retain in a context's executor service.
029     */
030    public static final int CORE_POOL_SIZE = 0;
031
032    // In Java 21 and later the actual threads are assumed to be virtual
033    public static final int SCHEDULED_EXECUTOR_POOL_SIZE = 4;
034
035    /**
036     * Maximum number of threads to allow in a context's executor service.
037     */
038    // if you need a different MAX_POOL_SIZE, please file create a github issue
039    // asking for a larger MAX_POOL_SIZE parameter.
040    public static final int MAX_POOL_SIZE = 32;
041
042    // Note that the line.separator property can be looked up even by
043    // applets.
044    public static final String LINE_SEPARATOR = System.getProperty("line.separator");
045    public static final int LINE_SEPARATOR_LEN = LINE_SEPARATOR.length();
046
047    public static final String CODES_URL = "http://logback.qos.ch/codes.html";
048    public static final String MANUAL_URL_PREFIX = "http://logback.qos.ch/manual/";
049    public static final String MORE_INFO_PREFIX = "For more information, please visit ";
050
051    /**
052     * The default context name.
053     */
054    public static final String DEFAULT_CONTEXT_NAME = "default";
055    /**
056     * Customized pattern conversion rules are stored under this key in the
057     * {@link Context} object store.
058     */
059    public static final String PATTERN_RULE_REGISTRY = "PATTERN_RULE_REGISTRY";
060
061    public static final String ISO8601_STR = "ISO8601";
062    public static final String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
063
064    /**
065     * Keyword for setting a strict ISO8601 pattern which includes 'T' between the date and the time
066     *
067     * @since 1.5.7
068     */
069    public static final String STRICT_STR = "STRICT";
070    /**
071     * Strict ISO8601 pattern which includes 'T' between the date and the time
072     * @since 15.7
073     */
074    public static final String STRICT_ISO8601_PATTERN = "yyyy-MM-dd'T'HH:mm:ss,SSS";
075
076
077    public static final String FILE_TIMESTAMP_PATTERN = "yyyy-MM-dd'T'HHmm";
078    public static final String DAILY_DATE_PATTERN = "yyyy-MM-dd";
079
080    /**
081     * Time format used in Common Log Format
082     */
083    public static final String CLF_DATE_PATTERN = "dd/MMM/yyyy:HH:mm:ss Z";
084
085    /**
086     * The key used in locating the evaluator map in context's object map.
087     */
088    public static final String EVALUATOR_MAP = "EVALUATOR_MAP";
089
090    /**
091     * Key used to locate a map Files used by FileAppender instances in context's
092     * object map.
093     * 
094     * Said map consists of entries of the type (appender name, File option)
095     */
096    public static final String FA_FILENAME_COLLISION_MAP = "FA_FILENAMES_MAP";
097
098    /**
099     * Key used to locate a collision map for RollingFileAppender instances in
100     * context's object map.
101     * 
102     * The collision map consists of entities of the type (appender name,
103     * FileNamePattern option)
104     */
105    public static final String RFA_FILENAME_PATTERN_COLLISION_MAP = "RFA_FILENAME_PATTERN_COLLISION_MAP";
106
107    /**
108     * By convention, we assume that the static method named "valueOf" taking a
109     * string argument can restore a given object from its string representation.
110     */
111    public static final String VALUE_OF = "valueOf";
112
113    /**
114     * An empty string.
115     */
116    public static final String EMPTY_STRING = "";
117
118    /**
119     * String value returned in case data is not available.
120     *
121     * For example, when caller information is not available this constant is used for file name,
122     * method name, etc.
123     */
124    public static final String NA = "?";
125
126    /**
127     * An empty string array.
128     */
129    public static final String[] EMPTY_STRING_ARRAY = new String[] {};
130
131    public static final Charset UTF_8_CHARSET = StandardCharsets.UTF_8;
132
133    /**
134     * An empty Class array.
135     */
136    public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[] {};
137    public static final String CAUSED_BY = "Caused by: ";
138    public static final String SUPPRESSED = "Suppressed: ";
139    public static final String WRAPPED_BY = "Wrapped by: ";
140
141    public static final char PERCENT_CHAR = '%';
142    public static final char LEFT_PARENTHESIS_CHAR = '(';
143    public static final char RIGHT_PARENTHESIS_CHAR = ')';
144
145    public static final char ESCAPE_CHAR = '\\';
146    public static final char CURLY_LEFT = '{';
147    public static final char CURLY_RIGHT = '}';
148    public static final char COMMA_CHAR = ',';
149    public static final char DOUBLE_QUOTE_CHAR = '"';
150    public static final char SINGLE_QUOTE_CHAR = '\'';
151    public static final char COLON_CHAR = ':';
152    public static final char DASH_CHAR = '-';
153    public static final char EQUALS_CHAR = '=';
154
155    public static final String DEFAULT_VALUE_SEPARATOR = ":-";
156
157    public static final String NULL_STR = "null";
158    /**
159     * Number of rows before in an HTML table before, we close the table and create
160     * a new one
161     */
162    public static final int TABLE_ROW_LIMIT = 10000;
163
164    // reset the ObjectOutputStream every OOS_RESET_FREQUENCY calls
165    // this avoids serious memory leaks
166    public static final int OOS_RESET_FREQUENCY = 70;
167
168    // See https://jakarta.ee/specifications/platform/8/platform-spec-8.html#a616
169    // there are the java:comp, java:module, java:app, java:global namespaces
170    public static final String JNDI_JAVA_NAMESPACE = "java:";
171
172    // the max number of times an error should be reported
173    public static final int MAX_ERROR_COUNT = 4;
174
175    public static final char DOT = '.';
176    public static final char TAB = '\t';
177    public static final char DOLLAR = '$';
178
179    public static final String SEE_FNP_NOT_SET = "See also " + CODES_URL + "#tbr_fnp_not_set";
180    public static final String SEE_MISSING_INTEGER_TOKEN = "See also " + CODES_URL + "#sat_missing_integer_token";
181
182    public static final String CONFIGURATION_WATCH_LIST = "CONFIGURATION_WATCH_LIST";
183    public static final String CONFIGURATION_WATCH_LIST_RESET_X = "CONFIGURATION_WATCH_LIST_RESET";
184
185    public static final String SAFE_JORAN_CONFIGURATION = "SAFE_JORAN_CONFIGURATION";
186    public static final String XML_PARSING = "XML_PARSING";
187
188    // Context Object name for the shutdown hook
189    public static final String SHUTDOWN_HOOK_THREAD = "SHUTDOWN_HOOK";
190
191    /**
192     * The key under which the local host name is registered in the logger context.
193     */
194    public static final String HOSTNAME_KEY = "HOSTNAME";
195
196    public static final String UNKNOWN_LOCALHOST = "UNKNOWN_LOCALHOST";
197
198    /**
199     * The key under which the current context name is registered in the logger
200     * context.
201     */
202    public static final String CONTEXT_NAME_KEY = "CONTEXT_NAME";
203
204    public static final int BYTES_PER_INT = 4;
205    public static final long MILLIS_IN_ONE_SECOND = 1000;
206    public static final long MILLIS_IN_ONE_MINUTE = MILLIS_IN_ONE_SECOND * 60;
207    public static final long MILLIS_IN_ONE_HOUR = MILLIS_IN_ONE_MINUTE * 60;
208    public static final long MILLIS_IN_ONE_DAY = MILLIS_IN_ONE_HOUR * 24;
209    public static final long MILLIS_IN_ONE_WEEK = MILLIS_IN_ONE_DAY * 7;
210
211    /**
212     * The number of seconds to wait for compression jobs to finish.
213     */
214    public static final int SECONDS_TO_WAIT_FOR_COMPRESSION_JOBS = 30;
215
216    public static final String CONTEXT_SCOPE_VALUE = "context";
217
218    public static final String RESET_MSG_PREFIX = "Will reset and reconfigure context ";
219
220    public static final String JNDI_COMP_PREFIX = "java:comp/env";
221
222    public static final String UNDEFINED_PROPERTY_SUFFIX = "_IS_UNDEFINED";
223
224    public static final String LEFT_ACCOLADE = new String(new char[] { CURLY_LEFT });
225    public static final String RIGHT_ACCOLADE = new String(new char[] { CURLY_RIGHT });
226    public static final long UNBOUNDED_TOTAL_SIZE_CAP = 0;
227
228    /**
229     * If Rolling
230     */
231    public static final int UNBOUNDED_HISTORY = 0;
232    
233    /**
234     * Replaced by {@link CoreConstants#UNBOUNDED_HISTORY} with the same identical value.
235
236     * @deprecated
237     * @see #UNBOUNDED_HISTORY
238     */
239    public static final int UNBOUND_HISTORY = UNBOUNDED_HISTORY;
240    
241    //public static final String RECONFIGURE_ON_CHANGE_TASK = "RECONFIGURE_ON_CHANGE_TASK";
242    public static final String SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED = "SizeAndTimeBasedFileNamingAndTriggeringPolicy is deprecated. Use SizeAndTimeBasedRollingPolicy instead";
243
244    public static final String LOGBACK_CLASSIC_VERSION_MESSAGE = "This is logback-classic version ";
245    public static final char JSON_LINE_SEPARATOR = '\n';
246    final public static String MODEL_CONFIG_FILE_EXTENSION = ".scmo";
247    /**
248     * since 1.5.8
249     */
250    final public static String PROPERTIES_FILE_EXTENSION = ".properties";
251}