Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6146797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:00:26+00:00 2026-05-23T19:00:26+00:00

In the FAQ for Log4perl it is explained how to write the config file

  • 0

In the FAQ for Log4perl it is explained how to write the config file to use separate files for ERROR and INFO.

This works great for one script or if one wants to mix several scripts ERROR and INFO into
the same ERROR and INFO logs.

Question

I would very much like each script have its own ERROR and INFO files, and that I still are able to just use

$logger->info()
$logger->error()

Have I made log.conf correct?

And how should I initiate Log4perl in each script?

account.pl

use Log::Log4perl;
Log::Log4perl::init('log.conf');
my $logger = Log::Log4perl->get_logger('????');

log.conf

log4perl.logger.account = INFO, AccountErrorLogFile, AccountInfoLogFile, AccountInfoLogFile, SystemErrorLogFile, testScreen

# Filter to match level ERROR
log4perl.filter.MatchError = Log::Log4perl::Filter::LevelMatch
log4perl.filter.MatchError.LevelToMatch  = ERROR
log4perl.filter.MatchError.AcceptOnMatch = true

# Filter to match level INFO
log4perl.filter.MatchInfo  = Log::Log4perl::Filter::LevelMatch
log4perl.filter.MatchInfo.LevelToMatch  = INFO
log4perl.filter.MatchInfo.AcceptOnMatch = true

# Error appender
log4perl.appender.AccountErrorLogFile                          = Log::Log4perl::Appender::File
log4perl.appender.AccountErrorLogFile.filename                 = /logs/error--account-pl.log
log4perl.appender.AccountErrorLogFile.layout                   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.AccountErrorLogFile.layout.ConversionPattern = %d [%3L] %m%n
log4perl.appender.AccountErrorLogFile.Filter                   = MatchError

# Info appender
log4perl.appender.AccountInfoLogFile                          = Log::Log4perl::Appender::File
log4perl.appender.AccountInfoLogFile.filename                 = /logs/info--account-pl.log
log4perl.appender.AccountInfoLogFile.layout                   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.AccountInfoLogFile.layout.ConversionPattern = %d [%3L] %m%n
log4perl.appender.AccountInfoLogFile.Filter                   = MatchInfo

# Error appender
log4perl.appender.SystemErrorLogFile                          = Log::Log4perl::Appender::File
log4perl.appender.SystemErrorLogFile.filename                 = /logs/error--system-pl.log
log4perl.appender.SystemErrorLogFile.layout                   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.SystemErrorLogFile.layout.ConversionPattern = %d [%3L] %m%n
log4perl.appender.SystemErrorLogFile.Filter                   = MatchError

# Info appender
log4perl.appender.SystemInfoLogFile                          = Log::Log4perl::Appender::File
log4perl.appender.SystemInfoLogFile.filename                 = /logs/info--system-pl.log
log4perl.appender.SystemInfoLogFile.layout                   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.SystemInfoLogFile.layout.ConversionPattern = %d [%3L] %m%n
log4perl.appender.SystemInfoLogFile.Filter                   = MatchInfo

# Development Appender
log4perl.appender.testScreen                          = Log::Log4perl::Appender::Screen
log4perl.appender.testScreen.stderr                   = 0
log4perl.appender.testScreen.layout                   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.testScreen.layout.ConversionPattern = %-5p [%3L] %m%n
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:00:27+00:00Added an answer on May 23, 2026 at 7:00 pm

    Solution:

    log.conf

    log4perl.logger.account = INFO, AccountErrorLogFile, AccountInfoLogFile, testScreen
    log4perl.logger.system  = INFO, SystemErrorLogFile, SystemInfoLogFile, testScreen
    

    account.pl

    Log::Log4perl::init('/var/www/useradmin/cgi-bin/log.conf');
    my $logger = Log::Log4perl->get_logger('account');
    

    system.pl

    Log::Log4perl::init('/var/www/useradmin/cgi-bin/log.conf');
    my $logger = Log::Log4perl->get_logger('system');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a FAQ i need a toggle panel similiar to this one: http://roshanbh.com.np/examples/exapandable-panel/ One
According to this Socket FAQ article , Nagle's algorithm is one of many algorithms
I am doing this faq section by getting content from json files, which I
I want to create an FAQ page like the one on this website http://www.microsoft.com/windows/windows-7/faq.aspx
Although this is FAQ i still couldn't find a suitable solution. I'd like to
Maybe a FAQ at this website. I have a TableViewController that holds a form.
This must be a FAQ, but I can’t find a duplicate question! There are
According to DOMPDF's FAQ , you can use page-break-before and the similar to force
This has got to be a FAQ, so can someone please just direct me
I cannot locate within the FAQ whether this functionality exists in the API although

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.