java.lang.Object
org.apache.jena.atlas.logging.LogCtl
Setup and control of logging.
Sources of configuration:
- Standard setup (e.g. for log4j2, property
log4j.configurationFile - jena-cmds: the shell scripts set logging to "apache-jena/log4j2.properties." (uses stderr)
- Default logging for log4j2: java resource src/main/resources/log4j-jena.properties (uses stdout)
- Implementation Note:
- This needs access to log4j2 binaries including log4j-core, which is encapsulated in LogCtlLog4j2.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringEnvironment variable for debugging logging initialization.static final StringThe log4j2 configuration file - must be a file or URL, not a classpath java resource.static final StringLegacy name for log4j2 configuration filestatic final StringProperty variable for debugging logging initialization. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidTurn on a logger (all levels).static voidTurn on a logger (all levels).static voiddisable(org.slf4j.Logger logger) Turn on a logger (all levels).static voidTurn on a logger (all levels).static voidstatic voidenable(org.slf4j.Logger logger) Turn on a logger (all levels).static Stringstatic Stringstatic StringgetLevel(org.slf4j.Logger logger) static voidstatic voidDeprecated, for removal: This API element is subject to removal in a future version.static voidSet to error level.static voidSet to error level.static voidSet to info level.static voidSet to info level.static voidSetup java.util.logging if it has not been set before; otherwise do nothing.static voidsetJavaLogging(String filename) Setup java.util.logging with the configuration from a file.static voidstatic voidstatic voidstatic voidSetup log4j2, including looking for a file "log4j2.properties" or "log4j2.xml" in the current working directory.static voidSet logging.static voidSet to warning level.static voidSet to warning level.static voidExecute with a given logging level.
-
Field Details
-
log4j2ConfigFileProperty
The log4j2 configuration file - must be a file or URL, not a classpath java resource.- See Also:
-
log4j2ConfigFilePropertyLegacy
Legacy name for log4j2 configuration file- See Also:
-
envLogLoggingProperty
Environment variable for debugging logging initialization. Set "true" to get trace on stderr.- See Also:
-
logLoggingProperty
Property variable for debugging logging initialization. Set "true" to get trace on stderr.- See Also:
-
-
Constructor Details
-
LogCtl
public LogCtl()
-
-
Method Details
-
set
-
setLevel
-
setLevel
-
setLevel
-
getLevel
-
getLevel
-
getLevel
-
enable
public static void enable(org.slf4j.Logger logger) Turn on a logger (all levels). Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
enable
-
enable
Turn on a logger (all levels). Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
disable
public static void disable(org.slf4j.Logger logger) Turn on a logger (all levels). Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
disable
Turn on a logger (all levels). Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
disable
Turn on a logger (all levels). Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
setInfo
Set to info level. Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
setInfo
Set to info level. Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
setWarn
Set to warning level. Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
setWarn
Set to warning level. Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
setError
Set to error level. Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
setError
Set to error level. Works for Log4j and Java logging as the logging provider to Apache common logging or slf4j. -
setLogging
public static void setLogging()Set logging.Normally, the logging provider mechanism should be used. This call will insert some kind of logging set for JUL and Log4j2 when no configuration is setup; output is to stdout.
Ideally, initialize the logging provider using the mechanism specific to that provider. For example, see the log4j2 configuration documentation.
To set application logging, choose one of:
- For JUL logging, have a dependency on artifact
org.slf4j:slf4j-jdk14. - For log4j2 logging, have a dependency on artifact
org.apache.logging.log4j:log4j-slf4j-impl.
- For JUL logging, have a dependency on artifact
-
setCmdLogging
Deprecated, for removal: This API element is subject to removal in a future version.UsesetLogging(). -
setLog4j2
public static void setLog4j2()Setup log4j2, including looking for a file "log4j2.properties" or "log4j2.xml" in the current working directory.- See Also:
-
setJavaLogging
public static void setJavaLogging()Setup java.util.logging if it has not been set before; otherwise do nothing. -
setJavaLogging
Setup java.util.logging with the configuration from a file.- Parameters:
filename-
-
withLevel
Execute with a given logging level.
-
setLogging().