1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.core;
15  
16  import java.nio.charset.Charset;
17  import java.nio.charset.StandardCharsets;
18  
19  public class CoreConstants {
20  
21      final public static String DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY = "logbackDisableServletContainerInitializer";
22      final public static String STATUS_LISTENER_CLASS_KEY = "logback.statusListenerClass";
23      final public static String SYSOUT = "SYSOUT";
24  
25      final public static String STDOUT = "STDOUT";
26  
27      /**
28       * Number of idle threads to retain in a context's executor service.
29       */
30      public static final int CORE_POOL_SIZE = 4;
31  
32      // In Java 21 and later the actual threads are assumed to be virtual
33      public static final int SCHEDULED_EXECUTOR_POOL_SIZE = 4;
34  
35      /**
36       * Maximum number of threads to allow in a context's executor service.
37       * @deprecated no longer used
38       *
39       */
40      public static final int MAX_POOL_SIZE = 32;
41  
42      // Note that the line.separator property can be looked up even by
43      // applets.
44      public static final String LINE_SEPARATOR = System.getProperty("line.separator");
45      public static final int LINE_SEPARATOR_LEN = LINE_SEPARATOR.length();
46  
47      public static final String CODES_URL = "https://logback.qos.ch/codes.html";
48      public static final String MANUAL_URL_PREFIX = "https://logback.qos.ch/manual/";
49      public static final String MORE_INFO_PREFIX = "For more information, please visit ";
50  
51      /**
52       * The default context name.
53       */
54      public static final String DEFAULT_CONTEXT_NAME = "default";
55  
56      /**
57       * Customized pattern conversion rules are stored under this key in the
58       * {@link Context} object store.
59       *
60       * @since 1.5.14
61       */
62      public static final String PATTERN_RULE_REGISTRY_FOR_SUPPLIERS = "PATTERN_RULE_REGISTRY_FOR_SUPPLIERS";
63  
64      /**
65       * Customized pattern conversion rules are stored under this key in the
66       * {@link Context} object store.
67       */
68      public static final String PATTERN_RULE_REGISTRY = "PATTERN_RULE_REGISTRY";
69  
70  
71  
72      public static final String ISO8601_STR = "ISO8601";
73      public static final String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
74  
75      /**
76       * Keyword for setting a strict ISO8601 pattern which includes 'T' between the date and the time
77       *
78       * @since 1.5.7
79       */
80      public static final String STRICT_STR = "STRICT";
81      /**
82       * Strict ISO8601 pattern which includes 'T' between the date and the time
83       * @since 15.7
84       */
85      public static final String STRICT_ISO8601_PATTERN = "yyyy-MM-dd'T'HH:mm:ss,SSS";
86  
87  
88      public static final String FILE_TIMESTAMP_PATTERN = "yyyy-MM-dd'T'HHmm";
89      public static final String DAILY_DATE_PATTERN = "yyyy-MM-dd";
90  
91      /**
92       * Time format used in Common Log Format
93       */
94      public static final String CLF_DATE_PATTERN = "dd/MMM/yyyy:HH:mm:ss Z";
95  
96      /**
97       * The key used in locating the evaluator map in context's object map.
98       */
99      public static final String EVALUATOR_MAP = "EVALUATOR_MAP";
100 
101     /**
102      * Key used to locate a map Files used by FileAppender instances in context's
103      * object map.
104      * 
105      * Said map consists of entries of the type (appender name, File option)
106      */
107     public static final String FA_FILENAME_COLLISION_MAP = "FA_FILENAMES_MAP";
108 
109     /**
110      * Key used to locate a collision map for RollingFileAppender instances in
111      * context's object map.
112      * 
113      * The collision map consists of entities of the type (appender name,
114      * FileNamePattern option)
115      */
116     public static final String RFA_FILENAME_PATTERN_COLLISION_MAP = "RFA_FILENAME_PATTERN_COLLISION_MAP";
117 
118     /**
119      * By convention, we assume that the static method named "valueOf" taking a
120      * string argument can restore a given object from its string representation.
121      */
122     public static final String VALUE_OF = "valueOf";
123 
124     /**
125      * An empty string.
126      */
127     public static final String EMPTY_STRING = "";
128 
129     /**
130      * String value returned in case data is not available.
131      *
132      * For example, when caller information is not available this constant is used for file name,
133      * method name, etc.
134      */
135     public static final String NA = "?";
136 
137     /**
138      * An empty string array.
139      */
140     public static final String[] EMPTY_STRING_ARRAY = new String[] {};
141 
142     public static final Charset UTF_8_CHARSET = StandardCharsets.UTF_8;
143 
144     /**
145      * An empty Class array.
146      */
147     public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[] {};
148     public static final String CAUSED_BY = "Caused by: ";
149     public static final String SUPPRESSED = "Suppressed: ";
150     public static final String WRAPPED_BY = "Wrapped by: ";
151 
152     public static final char PERCENT_CHAR = '%';
153     public static final char LEFT_PARENTHESIS_CHAR = '(';
154     public static final char RIGHT_PARENTHESIS_CHAR = ')';
155 
156     public static final char ESCAPE_CHAR = '\\';
157     public static final char CURLY_LEFT = '{';
158     public static final char CURLY_RIGHT = '}';
159     public static final char COMMA_CHAR = ',';
160     public static final char DOUBLE_QUOTE_CHAR = '"';
161     public static final char SINGLE_QUOTE_CHAR = '\'';
162     public static final char COLON_CHAR = ':';
163     public static final char DASH_CHAR = '-';
164     public static final char EQUALS_CHAR = '=';
165 
166     public static final String DEFAULT_VALUE_SEPARATOR = ":-";
167 
168     public static final String NULL_STR = "null";
169     /**
170      * Number of rows before in an HTML table before, we close the table and create
171      * a new one
172      */
173     public static final int TABLE_ROW_LIMIT = 10000;
174 
175     // reset the ObjectOutputStream every OOS_RESET_FREQUENCY calls
176     // this avoids serious memory leaks
177     public static final int OOS_RESET_FREQUENCY = 70;
178 
179     // See https://jakarta.ee/specifications/platform/8/platform-spec-8.html#a616
180     // there are the java:comp, java:module, java:app, java:global namespaces
181     public static final String JNDI_JAVA_NAMESPACE = "java:";
182 
183     // the max number of times an error should be reported
184     public static final int MAX_ERROR_COUNT = 4;
185 
186     public static final char DOT = '.';
187     public static final char TAB = '\t';
188     public static final char DOLLAR = '$';
189 
190     public static final String SEE_FNP_NOT_SET = "See also " + CODES_URL + "#tbr_fnp_not_set";
191     public static final String SEE_MISSING_INTEGER_TOKEN = "See also " + CODES_URL + "#sat_missing_integer_token";
192 
193     public static final String CONFIGURATION_WATCH_LIST = "CONFIGURATION_WATCH_LIST";
194     public static final String CONFIGURATION_WATCH_LIST_RESET_X = "CONFIGURATION_WATCH_LIST_RESET";
195 
196     public static final String SAFE_JORAN_CONFIGURATION = "SAFE_JORAN_CONFIGURATION";
197     public static final String XML_PARSING = "XML_PARSING";
198 
199     // Context Object name for the shutdown hook
200     public static final String SHUTDOWN_HOOK_THREAD = "SHUTDOWN_HOOK";
201 
202     /**
203      * The key under which the local host name is registered in the logger context.
204      */
205     public static final String HOSTNAME_KEY = "HOSTNAME";
206 
207     public static final String UNKNOWN_LOCALHOST = "UNKNOWN_LOCALHOST";
208 
209     /**
210      * The key under which the current context name is registered in the logger
211      * context.
212      */
213     public static final String CONTEXT_NAME_KEY = "CONTEXT_NAME";
214 
215     public static final int BYTES_PER_INT = 4;
216     public static final long MILLIS_IN_ONE_SECOND = 1000;
217     public static final long MILLIS_IN_ONE_MINUTE = MILLIS_IN_ONE_SECOND * 60;
218     public static final long MILLIS_IN_ONE_HOUR = MILLIS_IN_ONE_MINUTE * 60;
219     public static final long MILLIS_IN_ONE_DAY = MILLIS_IN_ONE_HOUR * 24;
220     public static final long MILLIS_IN_ONE_WEEK = MILLIS_IN_ONE_DAY * 7;
221 
222     /**
223      * The number of seconds to wait for compression jobs to finish.
224      */
225     public static final int SECONDS_TO_WAIT_FOR_COMPRESSION_JOBS = 30;
226 
227     public static final String CONTEXT_SCOPE_VALUE = "context";
228 
229     public static final String RESET_MSG_PREFIX = "Will reset and reconfigure context ";
230 
231     public static final String JNDI_COMP_PREFIX = "java:comp/env";
232 
233     public static final String UNDEFINED_PROPERTY_SUFFIX = "_IS_UNDEFINED";
234 
235     public static final String LEFT_ACCOLADE = new String(new char[] { CURLY_LEFT });
236     public static final String RIGHT_ACCOLADE = new String(new char[] { CURLY_RIGHT });
237     public static final long UNBOUNDED_TOTAL_SIZE_CAP = 0;
238 
239     /**
240      * If Rolling
241      */
242     public static final int UNBOUNDED_HISTORY = 0;
243     
244     /**
245      * Replaced by {@link CoreConstants#UNBOUNDED_HISTORY} with the same identical value.
246 
247      * @deprecated
248      * @see #UNBOUNDED_HISTORY
249      */
250     public static final int UNBOUND_HISTORY = UNBOUNDED_HISTORY;
251     
252     //public static final String RECONFIGURE_ON_CHANGE_TASK = "RECONFIGURE_ON_CHANGE_TASK";
253     public static final String SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED = "SizeAndTimeBasedFileNamingAndTriggeringPolicy is deprecated. Use SizeAndTimeBasedRollingPolicy instead";
254 
255     public static final char JSON_LINE_SEPARATOR = '\n';
256     final public static String MODEL_CONFIG_FILE_EXTENSION = ".scmo";
257     /**
258      * since 1.5.8
259      */
260     final public static String PROPERTIES_FILE_EXTENSION = ".properties";
261     public static final String LOGBACK_CORE_VERSION_MESSAGE = "This is logback-core version ";
262 }