Package org.apache.juneau.microservice
Class LogConfig
java.lang.Object
org.apache.juneau.microservice.LogConfig
Can be used for configuration of simple logging in the microservice.
Instances of this class can be created using create()
and passing the result to
Microservice.Builder.logConfig(LogConfig)
.
These values override values specified in the
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionappend()
Specified append mode for the log file.consoleLevel
(Level consoleLevel) The default logging level for the console.copy()
Creates a copy of this log configuration.count
(int count) The number of log files to use.static LogConfig
create()
Creates a new instance of this config.The default logging level for the log file.The log entry formatter.Default logging level for logger.Default logging levels for loggers.limit
(int limit) The maximum number of bytes to write to any one log file.The location of the log directory to create the log file.Returns the name of the log file on the file system to store the log file for this microservice.
-
Constructor Details
-
LogConfig
Copy constructor.- Parameters:
copyFrom
- The log config to copy from.
-
-
Method Details
-
copy
Creates a copy of this log configuration.- Returns:
- A new copy of this log configuration.
-
create
Creates a new instance of this config.- Returns:
- A new instance of this config.
-
logFile
Returns the name of the log file on the file system to store the log file for this microservice.This overrides the configuration value
"Logging/logFile" . If not specified, no file system logging will be used.- Parameters:
logFile
- The log file.- Returns:
- This object (for method chaining).
-
logDir
The location of the log directory to create the log file.This overrides the configuration value
"Logging/logDir" . If not specified, uses the JVM working directory.- Parameters:
logDir
- The log directory location as a path relative to the working directory.- Returns:
- This object (for method chaining).
-
formatter
The log entry formatter.If not specified, uses the following values pulled from the configuration to construct a
LogEntryFormatter
:"Logging/format" (default is"[{date} {level}] {msg}%n" )"Logging/dateFormat" (default is"yyyy.MM.dd hh:mm:ss" )"Logging/useStackTraceHashes" (default isfalse )
- Parameters:
formatter
- The log entry formatter.- Returns:
- This object (for method chaining).
- See Also:
-
append
Specified append mode for the log file.- Returns:
- This object (for method chaining).
-
limit
The maximum number of bytes to write to any one log file.- Parameters:
limit
- The number of bytes.- Returns:
- This object (for method chaining).
-
count
The number of log files to use.- Parameters:
count
- The number of log files.- Returns:
- This object (for method chaining).
-
fileLevel
The default logging level for the log file.- Parameters:
fileLevel
- The logging level.- Returns:
- This object (for method chaining).
-
consoleLevel
The default logging level for the console.- Parameters:
consoleLevel
- The logging level.- Returns:
- This object (for method chaining).
-
levels
Default logging levels for loggers.- Parameters:
levels
- A map of logger names to logger levels.- Returns:
- This object (for method chaining).
-
level
Default logging level for logger.- Parameters:
logger
- Logger name.level
- Logger level.- Returns:
- This object (for method chaining).
-