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

  • Home
  • SEARCH
  • 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 4261058
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:00:15+00:00 2026-05-21T06:00:15+00:00

I’m currently working on a logging solution for one of our web projects. Server

  • 0

I’m currently working on a logging solution for one of our web projects.

  • Server side language: PHP 5.2.3
  • Database: MySQL 5.0
  • Apache 2

Similar as described in here

MySQL Trigger based Audit logging with comparisons

we want to log changed columns for existing records, insertion of new records and deletion of records. For updates I have to somehow compare the old values
of the DB records with the the ones, the user saved. For insert the logging is easy and for delete I have to get the old values first to store then before deletion in the logging table.

The question I’m facing right now is. What do you think is the better solution.

Logging via Triggers on the DB level or using a suitable design pattern on the application level.

There already exists some threads about it, but there is no consideration what is better, one (Triggers) or the other (on application level).

In another thread AOP is suggested

Which design pattern would you consider when Logging is needed?

I’m going with the DB design for logging #1 as suggested in here

Audit Logging Strategies

where I have a separate table for logging for each observed table. The structure is like the following

ID : Integer
COLUMN: String, the column name of the column that changed
OLD_VAL: String
NEW_VAL: String
SOURCE: String, the source which changed the data, currently user and an agent are possible as sources
create_at: DATETIME, then the change occurred

So what do you people think. Considering performance vs. clean code and information hiding, what is the better solution to achieve a logging system like this.

Any ideas appreciated.

  • 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-21T06:00:16+00:00Added an answer on May 21, 2026 at 6:00 am

    If you do not do it in a trigger the likelihood that you will not log information you need is pretty close to 100%. Not all data is changed through applications. Even when developers think it will be. There are times when large amounts of data need to be fixed or updated (think a price increase of 10%) and those queries will happen directly on the database. To institute logging only through the application will mean you will miss those changes. Sometimes those are the changes made a malicous user or employee and are among the most important to audit.

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I have a JSP page retrieving data and when single or double quotes are

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.