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