.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Level 3" .TH Level 3 2026-08-14 "perl v5.42.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Log::Log4perl::Level \- Predefined log levels .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Log::Log4perl::Level; \& print $ERROR, "\en"; \& \& # \-\- or \-\- \& \& use Log::Log4perl qw(:levels); \& print $ERROR, "\en"; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`Log::Log4perl::Level\*(C'\fR simply exports a predefined set of \fILog4perl\fR log levels into the caller\*(Aqs name space. It is used internally by \&\f(CW\*(C`Log::Log4perl\*(C'\fR. The following scalars are defined: .PP .Vb 8 \& $OFF \& $FATAL \& $ERROR \& $WARN \& $INFO \& $DEBUG \& $TRACE \& $ALL .Ve .PP \&\f(CW\*(C`Log::Log4perl\*(C'\fR also exports these constants into the caller\*(Aqs namespace if you pull it in providing the \f(CW\*(C`:levels\*(C'\fR tag: .PP .Vb 1 \& use Log::Log4perl qw(:levels); .Ve .PP This is the preferred way, there\*(Aqs usually no need to call \&\f(CW\*(C`Log::Log4perl::Level\*(C'\fR explicitly. .PP The numerical values assigned to these constants are purely virtual, only used by Log::Log4perl internally and can change at any time, so please don\*(Aqt make any assumptions. You can test for numerical equality by directly comparing two level values, that\*(Aqs ok: .PP .Vb 3 \& if( get_logger()\->level() == $DEBUG ) { \& print "The logger\*(Aqs level is DEBUG\en"; \& } .Ve .PP But if you want to figure out which of two levels is more verbose, use Log4perl\*(Aqs own comparator: .PP .Vb 5 \& if( Log::Log4perl::Level::isGreaterOrEqual( $level1, $level2 ) ) { \& print Log::Log4perl::Level::to_level( $level1 ), \& " is equal or more verbose than ", \& Log::Log4perl::Level::to_level( $level2 ), "\en"; \& } .Ve .PP If the caller wants to import level constants into a different namespace, it can be provided with the \f(CW\*(C`use\*(C'\fR command: .PP .Vb 1 \& use Log::Log4perl::Level qw(MyNameSpace); .Ve .PP After this \f(CW$MyNameSpace::ERROR\fR, \f(CW$MyNameSpace::INFO\fR etc. will be defined accordingly. .SS "Numeric levels and Strings" .IX Subsection "Numeric levels and Strings" Level variables like \f(CW$DEBUG\fR or \f(CW$WARN\fR have numeric values that are internal to Log4perl. Transform them to strings that can be used in a Log4perl configuration file, use the c<\fBto_level()\fR> function provided by Log::Log4perl::Level: .PP .Vb 2 \& use Log::Log4perl qw(:easy); \& use Log::Log4perl::Level; \& \& # prints "DEBUG" \& print Log::Log4perl::Level::to_level( $DEBUG ), "\en"; .Ve .PP To perform the reverse transformation, which takes a string like "DEBUG" and converts it into a constant like \f(CW$DEBUG\fR, use the \&\fBto_priority()\fR function: .PP .Vb 2 \& use Log::Log4perl qw(:easy); \& use Log::Log4perl::Level; \& \& my $numval = Log::Log4perl::Level::to_priority( "DEBUG" ); .Ve .PP after which \f(CW$numval\fR could be used where a numerical value is required: .PP .Vb 1 \& Log::Log4perl\->easy_init( $numval ); .Ve .SH LICENSE .IX Header "LICENSE" Copyright 2002\-2026 by Mike Schilli and Kevin Goess . .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.