audit-logging

SQLAlchemy audit logging; how to handle deletes?

ぃ、小莉子 提交于 2019-12-04 13:46:14
问题 I'm using a modified version of the versioning code example that comes with SQLAlchemy to record a user id and date on changes. However, I also want to modify it so deletes are done by marking a is_deleted type flag instead of running an actual SQL DELETE . My problem is I'm not sure how to capture the delete and replace it with an update. Here's what I have so far: ''' http://docs.sqlalchemy.org/en/rel_0_8/orm/examples.html?highlight=versioning#versioned-objects ''' from sqlalchemy.ext

Injecting JPA's Entity Manager in Hibernate's EmptyInterceptor

霸气de小男生 提交于 2019-12-03 12:38:15
I am using JPA-2.0 with Hibernate in my data access layer. For audit logging purposes, I am using Hibernate's EmptyInterceptor by configuring below property in persistence.xml: <property name="hibernate.ejb.interceptor" value="com.mycom.audit.AuditLogInterceptor" /> Where AuditLogInterceptor extends hibernate's ' org.hibernate.EmptyInterceptor '. public class AuditLogInterceptor extends EmptyInterceptor { private Long userId; public AuditLogInterceptor() {} @Override public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws

How to Change the time zone in Python logging?

冷暖自知 提交于 2019-12-03 12:28:11
I would like to change the timestamp in the log file so that it reflects my current time zone so that i can debug errors at a faster rate, is it possible that i can change the time zone in the log file ? currently my config is: logging.basicConfig(filename='audit.log', filemode='w', level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p') #!/usr/bin/env python from datetime import datetime import logging import time from pytz import timezone, utc def main(): logging.basicConfig(format="%(asctime)s %(message)s", datefmt="%Y-%m-%d %H:%M:%S") logger = logging

How to get id from entity for Auditlog in Entity Framework 6

醉酒当歌 提交于 2019-12-03 08:26:56
问题 I know it's several similar posts out there, but I cannot find any with a solution to this issue. I want to add a (sort of) AudioLog when adding, changing or deleting entities (soft-delete) in Entity Framework 6. I've overridden the SaveChanges and because I only want to add log entries for EntityStates Added, Modified or Deleted, I fetch the list before I call SaveChanges the first time. The problem is, because I need to log what operation has been executed, I need to inspect the EntityState

SQLAlchemy audit logging; how to handle deletes?

微笑、不失礼 提交于 2019-12-03 07:46:51
I'm using a modified version of the versioning code example that comes with SQLAlchemy to record a user id and date on changes. However, I also want to modify it so deletes are done by marking a is_deleted type flag instead of running an actual SQL DELETE . My problem is I'm not sure how to capture the delete and replace it with an update. Here's what I have so far: ''' http://docs.sqlalchemy.org/en/rel_0_8/orm/examples.html?highlight=versioning#versioned-objects ''' from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.orm import mapper, class_mapper, attributes, object_mapper,

Log User Activity on ASP.NET MVC Application

十年热恋 提交于 2019-12-03 02:02:05
问题 Is there A good strategy to Log the User activity on an ASP MVC App? (ActionFilters/ HTTPModules). Something like last user activity (just like StackOverflow "Seen 23 mins ago"), and even what Pages and Controllers were used, and pushing even further what buttons or links were clicked. I have ELMAH installed but as far as i know its just for Error Logging. PD: Google Analytics is not an option. 回答1: You could try using a PostSharp aspect to perform the logging for you, it's multi-cast

How to get id from entity for Auditlog in Entity Framework 6

你离开我真会死。 提交于 2019-12-02 22:26:27
I know it's several similar posts out there, but I cannot find any with a solution to this issue. I want to add a (sort of) AudioLog when adding, changing or deleting entities (soft-delete) in Entity Framework 6. I've overridden the SaveChanges and because I only want to add log entries for EntityStates Added, Modified or Deleted, I fetch the list before I call SaveChanges the first time. The problem is, because I need to log what operation has been executed, I need to inspect the EntityState of the entities. But after SaveChanges is called, the EntityState is Unchanged for all entries. public

Log User Activity on ASP.NET MVC Application

南笙酒味 提交于 2019-12-02 15:37:51
Is there A good strategy to Log the User activity on an ASP MVC App? (ActionFilters/ HTTPModules). Something like last user activity (just like StackOverflow "Seen 23 mins ago"), and even what Pages and Controllers were used, and pushing even further what buttons or links were clicked. I have ELMAH installed but as far as i know its just for Error Logging. PD: Google Analytics is not an option. Rory You could try using a PostSharp aspect to perform the logging for you, it's multi-cast functionality might come in handy for something like that. If it's not an option, then a Module would probably