1JavaMap(3) User Contributed Perl Documentation JavaMap(3)
2
3
4
6 Log::Log4perl::JavaMap - maps java log4j appenders to Log::Dispatch
7 classes
8
10 ###############################
11 log4j.appender.FileAppndr1 = org.apache.log4j.FileAppender
12 log4j.appender.FileAppndr1.File = /var/log/onetime.log
13 log4j.appender.FileAppndr1.Append = false
14
15 log4j.appender.FileAppndr1.layout = org.apache.log4j.PatternLayout
16 log4j.appender.FileAppndr1.layout.ConversionPattern=%d %4r [%t] %-5p %c %x - %m%n
17 ###############################
18
20 If somebody wants to create an appender called
21 "org.apache.log4j.ConsoleAppender", we want to translate it to
22 Log::Dispatch::Screen, and then translate the log4j options into
23 Log::Dispatch parameters..
24
25 What's Implemented
26 (Note that you can always use the Log::Dispatch::* module. By
27 'implemented' I mean having a translation class that translates log4j
28 options into the Log::Dispatch options so you can use log4j rather than
29 log4perl syntax in your config file.)
30
31 Here's the list of appenders I see on the current (6/2002) log4j site.
32
33 These are implemented
34
35 ConsoleAppender - Log::Dispatch::Screen
36 FileAppender - Log::Dispatch::File
37 RollingFileAppender - Log::Dispatch::FileRotate (by Mark Pfeiffer)
38 JDBCAppender - Log::Log4perl::Appender::DBI
39 SyslogAppender - Log::Dispatch::Syslog
40 NTEventLogAppender - Log::Dispatch::Win32EventLog
41
42 These should/will/might be implemented
43
44 DailyRollingFileAppender -
45 SMTPAppender - Log::Dispatch::Email::MailSender
46
47 These might be implemented but they don't have corresponding classes in
48 Log::Dispatch (yet):
49
50 NullAppender
51 TelnetAppender
52
53 These might be simulated
54
55 LF5Appender - use Tk?
56 ExternallyRolledFileAppender - catch a HUP instead?
57
58 These will probably not be implemented
59
60 AsyncAppender
61 JMSAppender
62 SocketAppender - (ships a serialized LoggingEvent to the server side)
63 SocketHubAppender
64
66 Let's say you've in a mixed Java/Perl enviroment and you've come up
67 with some custom Java appender with behavior you want to use in both
68 worlds, "myorg.customAppender". You write a Perl appender with the
69 same behavior "Myorg::CustomAppender". You want to use one config file
70 accross both applications, so the config file will have to say
71 'myorg.customAppender'. But the mapping from "myorg.customAppender" to
72 "Myorg::CustomAppender" isn't in this JavaMap class, so what do you do?
73
74 In your Perl code, before you call Log::Log4perl::init(), do this:
75
76 $Log::Log4perl::JavaMap::user_defined{'myorg.customAppender'} =
77 'Myorg::CustomAppender';
78
79 and you can use 'myorg.customAppender' in your config file with
80 impunity.
81
83 http://jakarta.apache.org/log4j/docs/
84
86 Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess
87 <cpan@goess.org>.
88
89 This library is free software; you can redistribute it and/or modify it
90 under the same terms as Perl itself.
91
92
93
94perl v5.12.2 2010-08-31 JavaMap(3)