One of the applications I maintain has a similar structure but adds to it by having an application_event_type table
ID,VALUE
0,CREATE
1,ASSIGN
3,UPDATE
2,DELETE
4,UNASSIGN
5,APPROVE
6,MARK_AS_DUPLICATE
and the master table looks like this
CREATE TABLE APPLICATION_LOGGING
(
ID NUMBER(9) NOT NULL,
CURRENT_USER_ID NUMBER(9),
EVENT_ID NUMBER(9) NOT NULL,
ENTRY_DATE DATE NOT NULL,
MESSAGE VARCHAR2(200 CHAR) NOT NULL,
MESSAGE_PARAMETERS VARCHAR2(2000 CHAR) NOT NULL
)
I found that logging is something that more people are interested in than I would have expected. Managers want to know who did what. For them, a cryptic log entry was not enough. Message and Message_parameters were lengthy text strings with too much information. I had to make a linking table which condensed the message and message paramters into english or french
CREATE TABLE APPLICATION_LOGGING_NEW
(
ID NUMBER(10) NOT NULL,
LOG_ID VARCHAR2(50 BYTE) NOT NULL,
EVENT_ID NUMBER(10),
MESSAGE VARCHAR2(500 BYTE) NOT NULL,
LOCALE_ID NUMBER(10) DEFAULT 2 NOT NULL,
LOG_TYPE NUMBER(10) DEFAULT 1 NOT NULL,
DATE_CREATED TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
CREATED_BY_USER_ID NUMBER(9) DEFAULT 355 NOT NULL,
DATE_LAST_MODIFIED TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
LAST_MODIFIED_BY_USER_ID NUMBER(9) DEFAULT 355 NOT NULL
)
Another database I work with has extensive logging. Anytime you "look" at something an insert is done. This seemed like a great feature but the logging table is now three times the size of the top five largest tables. Querying and inserting this table have a definite effect on performance.
Logging is a fine art: too much and you can affect performance, not enough and you cannot answer a reasonable question. It is well worth investing the time to find the right balance.