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
016public class CoreConstants {
017
018    final public static String DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY = "logbackDisableServletContainerInitializer";
019    final public static String STATUS_LISTENER_CLASS_KEY = "logback.statusListenerClass";
020    final public static String SYSOUT = "SYSOUT";
021
022    /**
023     * Number of idle threads to retain in a context's executor service.
024     */
025    public static final int CORE_POOL_SIZE = 0;
026
027    // Apparently ScheduledThreadPoolExecutor has limitation where a task cannot be
028    // submitted from
029    // within a running task unless the pool has worker threads already available.
030    // ThreadPoolExecutor
031    // does not have this limitation.
032    // This causes tests failures in
033    // SocketReceiverTest.testDispatchEventForEnabledLevel and
034    // ServerSocketReceiverFunctionalTest.testLogEventFromClient.
035    // We thus set a pool size > 0 for tests to pass.
036    public static final int SCHEDULED_EXECUTOR_POOL_SIZE = 1;
037
038    /**
039     * Maximum number of threads to allow in a context's executor service.
040     */
041    // if you need a different MAX_POOL_SIZE, please file create a jira issue
042    // asking to make MAX_POOL_SIZE a parameter.
043    public static final int MAX_POOL_SIZE = 32;
044
045    // Note that the line.separator property can be looked up even by
046    // applets.
047    public static final String LINE_SEPARATOR = System.getProperty("line.separator");
048    public static final int LINE_SEPARATOR_LEN = LINE_SEPARATOR.length();
049
050    public static final String CODES_URL = "http://logback.qos.ch/codes.html";
051    public static final String MANUAL_URL_PREFIX = "http://logback.qos.ch/manual/";
052    public static final String MORE_INFO_PREFIX = "For more information, please visit ";
053
054    /**
055     * The default context name.
056     */
057    public static final String DEFAULT_CONTEXT_NAME = "default";
058    /**
059     * Customized pattern conversion rules are stored under this key in the
060     * {@link Context} object store.
061     */
062    public static final String PATTERN_RULE_REGISTRY = "PATTERN_RULE_REGISTRY";
063
064    public static final String ISO8601_STR = "ISO8601";
065    public static final String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
066    public static final String DAILY_DATE_PATTERN = "yyyy-MM-dd";
067
068    /**
069     * Time format used in Common Log Format
070     */
071    public static final String CLF_DATE_PATTERN = "dd/MMM/yyyy:HH:mm:ss Z";
072
073    /**
074     * The key used in locating the evaluator map in context's object map.
075     */
076    public static final String EVALUATOR_MAP = "EVALUATOR_MAP";
077
078    /**
079     * Key used to locate a map Files used by FileAppender instances in context's
080     * object map.
081     * 
082     * Said map consists of entries of the type (appender name, File option)
083     */
084    public static final String FA_FILENAME_COLLISION_MAP = "FA_FILENAMES_MAP";
085
086    /**
087     * Key used to locate a collision map for RollingFileAppender instances in
088     * context's object map.
089     * 
090     * The collision map consists of entities of the type (appender name,
091     * FileNamePattern option)
092     */
093    public static final String RFA_FILENAME_PATTERN_COLLISION_MAP = "RFA_FILENAME_PATTERN_COLLISION_MAP";
094
095    /**
096     * By convention, we assume that the static method named "valueOf" taking a
097     * string argument can restore a given object from its string representation.
098     */
099    public static final String VALUE_OF = "valueOf";
100
101    /**
102     * An empty string.
103     */
104    public static final String EMPTY_STRING = "";
105
106    /**
107     * String value returned in case data is not available.
108     *
109     * For example, when caller information is not available this constant is used for file name,
110     * method name, etc.
111     */
112    public static final String NA = "?";
113
114    /**
115     * An empty string array.
116     */
117    public static final String[] EMPTY_STRING_ARRAY = new String[] {};
118
119    /**
120     * An empty Class array.
121     */
122    public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[] {};
123    public static final String CAUSED_BY = "Caused by: ";
124    public static final String SUPPRESSED = "Suppressed: ";
125    public static final String WRAPPED_BY = "Wrapped by: ";
126
127    public static final char PERCENT_CHAR = '%';
128    public static final char LEFT_PARENTHESIS_CHAR = '(';
129    public static final char RIGHT_PARENTHESIS_CHAR = ')';
130
131    public static final char ESCAPE_CHAR = '\\';
132    public static final char CURLY_LEFT = '{';
133    public static final char CURLY_RIGHT = '}';
134    public static final char COMMA_CHAR = ',';
135    public static final char DOUBLE_QUOTE_CHAR = '"';
136    public static final char SINGLE_QUOTE_CHAR = '\'';
137    public static final char COLON_CHAR = ':';
138    public static final char DASH_CHAR = '-';
139    public static final String DEFAULT_VALUE_SEPARATOR = ":-";
140
141    /**
142     * Number of rows before in an HTML table before, we close the table and create
143     * a new one
144     */
145    public static final int TABLE_ROW_LIMIT = 10000;
146
147    // reset the ObjectOutputStream every OOS_RESET_FREQUENCY calls
148    // this avoids serious memory leaks
149    public static final int OOS_RESET_FREQUENCY = 70;
150
151    // See https://jakarta.ee/specifications/platform/8/platform-spec-8.html#a616
152    // there are the java:comp, java:module, java:app, java:global namespaces
153    public static final String JNDI_JAVA_NAMESPACE = "java:";
154
155    // the max number of times an error should be reported
156    public static final int MAX_ERROR_COUNT = 4;
157
158    public static final char DOT = '.';
159    public static final char TAB = '\t';
160    public static final char DOLLAR = '$';
161
162    public static final String SEE_FNP_NOT_SET = "See also " + CODES_URL + "#tbr_fnp_not_set";
163    public static final String SEE_MISSING_INTEGER_TOKEN = "See also " + CODES_URL + "#sat_missing_integer_token";
164
165    public static final String CONFIGURATION_WATCH_LIST = "CONFIGURATION_WATCH_LIST";
166    public static final String CONFIGURATION_WATCH_LIST_RESET_X = "CONFIGURATION_WATCH_LIST_RESET";
167
168    public static final String SAFE_JORAN_CONFIGURATION = "SAFE_JORAN_CONFIGURATION";
169    public static final String XML_PARSING = "XML_PARSING";
170
171    // Context Object name for the shutdown hook
172    public static final String SHUTDOWN_HOOK_THREAD = "SHUTDOWN_HOOK";
173
174    /**
175     * The key under which the local host name is registered in the logger context.
176     */
177    public static final String HOSTNAME_KEY = "HOSTNAME";
178
179    public static final String UNKNOWN_LOCALHOST = "UNKNOWN_LOCALHOST";
180
181    /**
182     * The key under which the current context name is registered in the logger
183     * context.
184     */
185    public static final String CONTEXT_NAME_KEY = "CONTEXT_NAME";
186
187    public static final int BYTES_PER_INT = 4;
188    public static final long MILLIS_IN_ONE_SECOND = 1000;
189    public static final long MILLIS_IN_ONE_MINUTE = MILLIS_IN_ONE_SECOND * 60;
190    public static final long MILLIS_IN_ONE_HOUR = MILLIS_IN_ONE_MINUTE * 60;
191    public static final long MILLIS_IN_ONE_DAY = MILLIS_IN_ONE_HOUR * 24;
192    public static final long MILLIS_IN_ONE_WEEK = MILLIS_IN_ONE_DAY * 7;
193
194    /**
195     * The number of seconds to wait for compression jobs to finish.
196     */
197    public static final int SECONDS_TO_WAIT_FOR_COMPRESSION_JOBS = 30;
198
199    public static final String CONTEXT_SCOPE_VALUE = "context";
200
201    public static final String RESET_MSG_PREFIX = "Will reset and reconfigure context ";
202
203    public static final String JNDI_COMP_PREFIX = "java:comp/env";
204
205    public static final String UNDEFINED_PROPERTY_SUFFIX = "_IS_UNDEFINED";
206
207    public static final String LEFT_ACCOLADE = new String(new char[] { CURLY_LEFT });
208    public static final String RIGHT_ACCOLADE = new String(new char[] { CURLY_RIGHT });
209    public static final long UNBOUNDED_TOTAL_SIZE_CAP = 0;
210
211    /**
212     * If Rolling
213     */
214    public static final int UNBOUNDED_HISTORY = 0;
215    
216    /**
217     * Replaced by {@link CoreConstants#UNBOUNDED_HISTORY} with the same identical value.
218
219     * @deprecated
220     * @see #UNBOUNDED_HISTORY
221     */
222    public static final int UNBOUND_HISTORY = UNBOUNDED_HISTORY;
223    
224    public static final String RECONFIGURE_ON_CHANGE_TASK = "RECONFIGURE_ON_CHANGE_TASK";
225    public static final String SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED = "SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead";
226
227    public static final String LOGBACK_CLASSIC_VERSION_MESSAGE = "This is logback-classic version ";
228}