.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 turned on, 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Config::DOMConfigurator 3pm" .TH Config::DOMConfigurator 3pm "2014-03-05" "perl v5.18.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::Config::DOMConfigurator \- reads xml config files .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& \-\-using the log4j DTD\-\- \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& \-\-using the log4perl DTD\-\- \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& mary@another.jabber.server \& \& \& \& \& \& sub { return sprintf "%1x", $$} \& \& \& sub {return \*(AqthisistheGcspec\*(Aq} \& \& \& \& \& \& \& \& \& \& \& \& \& INSERT INTO log4perltest \& (loglevel, message, shortcaller, thingid, \& category, pkg, runtime1, runtime2) \& VALUES \& (?,?,?,?,?,?,?,?) \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module implements an \s-1XML\s0 config, complementing the properties-style config described elsewhere. .SH "WHY" .IX Header "WHY" \&\*(L"Why would I want my config in \s-1XML\s0?\*(R" you ask. Well, there are a couple reasons you might want to. Maybe you have a personal preference for \s-1XML. \s0 Maybe you manage your config with other tools that have an affinity for \s-1XML,\s0 like XML-aware editors or automated config generators. Or maybe (and this is the big one) you don't like having to run your application just to check the syntax of your config file. .PP By using an \s-1XML\s0 config and referencing a \s-1DTD,\s0 you can use a namespace-aware validating parser to see if your \s-1XML\s0 config at least follows the rules set in the \s-1DTD. \s0 .SH "HOW" .IX Header "HOW" To reference a \s-1DTD,\s0 drop this in after the declaration in your config file: .PP .Vb 1 \& .Ve .PP That tells the parser to validate your config against the \s-1DTD\s0 in \&\*(L"log4perl.dtd\*(R", which is available in the xml/ directory of the log4perl distribution. Note that you'll also need to grab the log4j\-1.2.dtd from there as well, since the it's included by log4perl.dtd. .PP Namespace-aware validating parsers are not the norm in Perl. But the Xerces project (http://xml.apache.org/xerces\-c/index.html \-\-lots of binaries available, even rpm's) does provide just such a parser that you can use like this: .PP .Vb 1 \& StdInParse \-ns \-v < my\-log4perl\-config.xml .Ve .PP This module itself does not use a validating parser, the obvious one XML::DOM::ValParser doesn't seem to handle namespaces. .SH "WHY TWO DTDs" .IX Header "WHY TWO DTDs" The log4j \s-1DTD\s0 is from the log4j project, they designed it to handle their needs. log4perl has added some extensions to the original log4j functionality which needed some extensions to the log4j \s-1DTD. \s0 If you aren't using these features then you can validate your config against the log4j dtd and know that you're using unadulterated log4j config tags. .PP The features added by the log4perl dtd are: .IP "1 oneMessagePerAppender global setting" 4 .IX Item "1 oneMessagePerAppender global setting" .Vb 1 \& log4perl.oneMessagePerAppender=1 .Ve .IP "2 globally defined user conversion specifiers" 4 .IX Item "2 globally defined user conversion specifiers" .Vb 1 \& log4perl.PatternLayout.cspec.G=sub { return "UID $< GID $("; } .Ve .IP "3 appender-local custom conversion specifiers" 4 .IX Item "3 appender-local custom conversion specifiers" .Vb 1 \& log4j.appender.appndr1.layout.cspec.K = sub {return sprintf "%1x", $$ } .Ve .IP "4 nested options" 4 .IX Item "4 nested options" .Vb 5 \& log4j.appender.jabbender = Log::Dispatch::Jabber \& #(note how these are nested under \*(Aqlogin\*(Aq) \& log4j.appender.jabbender.login.hostname = a.jabber.server \& log4j.appender.jabbender.login.port = 5222 \& log4j.appender.jabbender.login.username = bobjones .Ve .IP "5 the log4perl\-specific filters, see Log::Log4perl::Filter, lots of examples in t/044XML\-Filter.t, here's a short one:" 4 .IX Item "5 the log4perl-specific filters, see Log::Log4perl::Filter, lots of examples in t/044XML-Filter.t, here's a short one:" .Vb 2 \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& sub { \& /and that, too/ \& } \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& .Ve .PP So we needed to extend the log4j dtd to cover these additions. Now I could have just taken a 'steal this code' approach and mixed parts of the log4j dtd into a log4perl dtd, but that would be cut-n-paste programming. So I've used namespaces and .IP "\(bu" 4 replaced three elements: .RS 4 .IP "" 4 .IX Item "" handles #1) and accepts .IP "" 4 .IX Item "" accepts and .IP "" 4 .IX Item "" accepts custom cspecs for #3) .RE .RS 4 .RE .IP "\(bu" 4 added a element (complementing the element) to handle #4) .IP "\(bu" 4 added a root element to handle #2) .IP "\(bu" 4 added which lets you put things like perl code into escaped \s-1CDATA\s0 between the tags, so you don't have to worry about escaping characters and quotes .IP "\(bu" 4 added .PP See the examples up in the \*(L"\s-1SYNOPSIS\*(R"\s0 for how all that gets used. .SH "WHY NAMESPACES" .IX Header "WHY NAMESPACES" I liked the idea of using the log4j \s-1DTD \s0\fIin situ\fR, so I used namespaces to extend it. If you really don't like having to type instead of just , you can make your own \s-1DTD\s0 combining the two DTDs and getting rid of the namespace prefixes. Then you can validate against that, and log4perl should accept it just fine. .SH "VARIABLE SUBSTITUTION" .IX Header "VARIABLE SUBSTITUTION" This supports variable substitution like \f(CW\*(C`${foobar}\*(C'\fR in text and in attribute values except for appender-ref. If an environment variable is defined for that name, its value is substituted. So you can do stuff like .PP .Vb 2 \& \& ${currentsysadmin}@foo.com .Ve .SH "REQUIRES" .IX Header "REQUIRES" To use this module you need \s-1XML::DOM\s0 installed. .PP To use the log4perl.dtd, you'll have to reference it in your \s-1XML\s0 config, and you'll also need to note that log4perl.dtd references the log4j dtd as \*(L"log4j\-1.2.dtd\*(R", so your validator needs to be able to find that file as well. If you don't like having to schlep two files around, feel free to dump the contents of \*(L"log4j\-1.2.dtd\*(R" into your \*(L"log4perl.dtd\*(R" file. .SH "CAVEATS" .IX Header "CAVEATS" You can't mix a multiple param-nesteds with the same name, I'm going to leave that for now, there's presently no need for a list of structs in the config. .SH "CHANGES" .IX Header "CHANGES" 0.03 2/26/2003 Added support for log4perl extensions to the log4j dtd .SH "SEE ALSO" .IX Header "SEE ALSO" t/038XML\-DOM1.t, t/039XML\-DOM2.t for examples .PP xml/log4perl.dtd, xml/log4j\-1.2.dtd .PP Log::Log4perl::Config .PP Log::Log4perl::Config::PropertyConfigurator .PP Log::Log4perl::Config::LDAPConfigurator (coming soon!) .PP The code is brazenly modeled on log4j's DOMConfigurator class, (by Christopher Taylor, Ceki Gu\*:lcu\*:, and Anders Kristensen) and any perceived similarity is not coincidental. .SH "LICENSE" .IX Header "LICENSE" Copyright 2002\-2013 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. .SH "AUTHOR" .IX Header "AUTHOR" Please contribute patches to the project on Github: .PP .Vb 1 \& http://github.com/mschilli/log4perl .Ve .PP Send bug reports or requests for enhancements to the authors via our .PP \&\s-1MAILING LIST \s0(questions, bug reports, suggestions/patches): log4perl\-devel@lists.sourceforge.net .PP Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess .PP Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang.