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