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 463327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:09:51+00:00 2026-05-12T23:09:51+00:00

I am just starting with log4j. I don’t have a problem with it reading

  • 0

I am just starting with log4j. I don’t have a problem with it reading my properties file and actually logging events, but it seems to be appending everything to the end of the same line. My properties file looks like this:

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A2 is set to be a ConsoleAppender.
log4j.appender.A2=org.apache.log4j.FileAppender

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

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

log4j.appender.A2.file=grocerylister.log

The above was modified from an example in log4j the Complete Manual. I have fruitlessly looked through the book and Google to get a listing of what all the options mean, to no avail.

I’m using log4j version 1.2.15 with Java 6. What can I do to get each log entry on a separate line and where can I find a list of what all the options are and what they do?

  • 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-12T23:09:52+00:00Added an answer on May 12, 2026 at 11:09 pm

    Replace

    log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x -
    %m%n
    

    with

    log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
    

    Same for A2 + there remove the % after the n %m%n% -> m%n

    Basically you seem to have a newline after the - character in your ConversionPattern lines. That would explain why the newline isn’t output (%n –> outputs platform dependend newline character)

    Btw. if you want to know what the options mean

    javadoc: PatternLayout

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just starting out with my first commercial app for the iStore but dont have
Just starting out with jQuery and this problem seems to be impossible to me.
Just starting programming, so don`t kick too hard, question is pretty self explanatory, but
Just starting with FactoryGirl. I have a Model named Subscription . It has a
Just starting out with subversion, have set up repos for 3 current projects and
Just starting out, this should be a simple one but I haven't been able
Just starting using the Firebug console. I have a test script which I'll post
Just starting to use Cruise Control, but can't seem to find anything on this
Just starting to use Ruby on Rails to see what its like. I have
Just starting out in Unix and need t workout this:- I have a csv

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.