JavaMap(3)

JavaMap(3) β€” Log::Log4perl::JavaMap πŸ’…βœ¨

okay so bestie, this is the JavaMap(3) page from User Contributed Perl Documentation, and it's literally about the matchmaking magic of Log::Log4perl::JavaMap. Think less β€œboring manpage” and more β€œgroup chat with a Unix girlie who knows her stuff.” 🫢


πŸ’– NAME πŸ’–

Log::Log4perl::JavaMap β€” maps java log4j appenders to Log::Dispatch classes. no cap, that's the whole gig. 🌈

✨ SYNOPSIS ✨

Here's the config vibe:

###############################
log4j.appender.FileAppndr1        = org.apache.log4j.FileAppender
log4j.appender.FileAppndr1.File   = /var/log/onetime.log
log4j.appender.FileAppndr1.Append = false

log4j.appender.FileAppndr1.layout = org.apache.log4j.PatternLayout
log4j.appender.FileAppndr1.layout.ConversionPattern=%d %4r [%t] %-5p %c %x - %m%n
###############################

🌸 DESCRIPTION 🌸

okay so picture this: somebody wants to create an appender called org.apache.log4j.ConsoleAppender. We want to translate it to Log::Dispatch::Screen, and then translate the log4j options into Log::Dispatch parameters. it's giving translator energy, honestly. πŸ’«

πŸŽ€ What's Implemented πŸŽ€

Quick note before the list: you can always use the Log::Dispatch::* module. By β€œimplemented” I mean having a translation class that translates log4j options into the Log::Dispatch options, so you can use log4j rather than log4perl syntax in your config file. iykyk. πŸ‘‘

Here's the list of appenders I see on the current (6/2002) log4j site.

These are implemented β€” slay:

  • ConsoleAppender β€” Log::Dispatch::Screen
  • FileAppender β€” Log::Dispatch::File
  • RollingFileAppender β€” Log::Dispatch::FileRotate (by Mark Pfeiffer)
  • JDBCAppender β€” Log::Log4perl::Appender::DBI
  • SyslogAppender β€” Log::Dispatch::Syslog
  • NTEventLogAppender β€” Log::Dispatch::Win32EventLog

These should/will/might be implemented β€” the maybe list:

  • DailyRollingFileAppender -
  • SMTPAppender β€” Log::Dispatch::Email::MailSender

These might be implemented but they don't have corresponding classes in Log::Dispatch (yet):

  • NullAppender
  • TelnetAppender

These might be simulated β€” fake it till you make it energy:

  • LF5Appender β€” use Tk?
  • ExternallyRolledFileAppender β€” catch a HUP instead?

These will probably not be implemented β€” rip:

  • AsyncAppender
  • JMSAppender
  • SocketAppender β€” (ships a serialized LoggingEvent to the server side)
  • SocketHubAppender

πŸ¦‹ ROLL YOUR OWN πŸ¦‹

Let's say you're in a mixed Java/Perl environment and you've come up with some custom Java appender with behavior you want to use in both worlds, myorg.customAppender. You write a Perl appender with the same behavior Myorg::CustomAppender. You want to use one config file across both applications, so the config file will have to say 'myorg.customAppender'. But the mapping from myorg.customAppender to Myorg::CustomAppender isn't in this JavaMap class, so what do you do? πŸ€”

In your Perl code, before you call Log::Log4perl::init(), do this:

$Log::Log4perl::JavaMap::user_defined{'myorg.customAppender'} =
    'Myorg::CustomAppender';

and you can use 'myorg.customAppender' in your config file with impunity. periodt. πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

πŸ‘‘ LICENSE πŸ‘‘

Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

πŸ’œ AUTHOR πŸ’œ

Please contribute patches to the project on Github:

http://github.com/mschilli/log4perl

Send bug reports or requests for enhancements to the authors via our

MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net

Authors (please contact them via the list above, not directly): Mike Schilli <m@perlmeister.com>, Kevin Goess <cpan@goess.org>

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.


🫢 okay that's the whole page, bestie! This iconic little manual is from perl v5.42.0, dated 2022-10-22, and yes β€” it's JavaMap(3). mwah πŸ’‹βœ¨
πŸ“¦ where this page comes from