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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:51:42+00:00 2026-05-25T01:51:42+00:00

Are log files not meant to be read by machines but by users only?

  • 0

Are log files not meant to be read by machines but by users only? I wonder if there are file appenders for any logging framework that write their output to XML.

  • 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-25T01:51:43+00:00Added an answer on May 25, 2026 at 1:51 am

    “Logging to XML” is quite a general requirement, because there is no such thing as the standard log file format. But since XML files are text files, which logging frameworks can write, and since many of those frameworks allow configuring log line format, I see no problem in defining your log output with XML tags of choice.

    For log4j, it might be something like this:

    log4j.appender.A1.layout.ConversionPattern=<line>%n<date>%d</date>%n<threadName>%t</threadName>%n<level>%p</level>%n<logger>%c</logger>%n<text>%m</text>%n</line>%n
    

    yielding example output:

    <line>
    <date>2011-08-28 08:27:33,727</date>
    <threadName>main</threadName>
    <level>INFO</level>
    <logger>com.log4jeval.Main</logger>
    <text>Entering application.</text>
    </line>
    

    This looks quite like XML, doesn’t it? It will lack XML preamble, though, so technically it won’t be valid. If it’s critical that it is, I recommend writing a custom appender extending org.apache.log4j.FileAppender (or any of its subclasses) that would handle any additional opening/closing text in every log file.

    The problem with writing logs to XML, that does not exist in plain text files, is that you have to enforce that not one possible log statement would print XML forbidden characters, otherwise you’ll end up with a non well-formed XML. That’s hard to achieve without writing a custom appender — see org.apache.log4j.HTMLAppender sources for example.

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

Sidebar

Related Questions

I need to read through some gigantic log files on a Linux system. There's
Is there a log viewer for displaying Ruby log files from any of its
hg log works. hg log --style does not work. C:\temp\myhg> c:\program files\mercurial\hg log changeset:
Copied from my log file ActionView::Template::Error (Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs
We have multiple log files like database log, weblog, quartzlog in our application. Any
I read log files programmatically using logservice.fetch() After a certain number of reads OVER
How to attach multiple files in email in android? Is there any permission required
I am building application that required some data from iPhone's Call log(read only). The
I have some HUGE log files (50Mb; ~500K lines) I need to start filtering
I have a few log files like these: /var/log/pureftpd.log /var/log/pureftpd.log-20100328 /var/log/pureftpd.log-20100322 Is it possible

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.