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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:25:57+00:00 2026-06-03T09:25:57+00:00

If I have an application that writes a log file to the filesystem, and

  • 0

If I have an application that writes a log file to the filesystem, and I later want to be able to dump those logs into a RDBMS to be able to query easier on specific items (e.g. I want to query all logs related to transaction ID X, not just queries like everything with a log level of INFO or since some date).

What is a robust way of formatting the log messages to be able to easily put it in a RDBMS to allow for future changes in what I am actually logging (adding more things)?

  • 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-06-03T09:25:58+00:00Added an answer on June 3, 2026 at 9:25 am

    Code the attributes of the log entry as name-value pairs. You will need to make a choice about the delimiter for the value part; that is, it needs to be something that won’t appear in the value itself.

    Some attributes of the log entry, if you haven’t thought about that part of the problem:

    • timestamp
    • severity (fatal, error, info, debug), probably as a string
    • location in the source code from which the entry was made, as a file name and line number and/or class name and method name
    • transaction
    • free text: whatever the code needs to record in the entry

    Also consider:

    • stack trace: kind of messy, since it tends to be an unspecified iteration
    • exception information provided by your runtime (C#? Java?)
    • user ID
    • thread info

    It’s that free text attribute that will compete with your delimiter choice.

    A toy example log entry, using double brackets as a delimiter:

    timemstamp=[[24-Apr-2012 15:48:28.749]] severity=[[error]] location=[[Foo.java (45)]] transaction=[[48241]] free=[[Cannot open file 'zqx3.txt']]
    

    Your question is not tagged with an implementation language. In Java land, log4j is a popular framework for logging. I believe there are suitable ports or work-alikes for .NET.

    See also A simple log file format.

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

Sidebar

Related Questions

I have a C# windows service application that generates a log file that writes
I have an application that on closing, it writes to a log file. BUT
I have a server application that writes to a popen(myCommand, w) file descriptor in
In Python, I have an application that writes a list to a CSV file,
I have a windows service that writes out log file entries to an XML
I have an application that writes to a folder on the C:\ drive. The
I have an application that writes many times to a formula/macro-laden workbook. It loops
I have a small homework application that writes random numbers from 5 to 77
I am writing an application that writes to SQL Compact files that have a
I have a UNIX application written in ansi C that writes data directly to

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.