Comments (15)
Please share the configuration you are using.
from audit4j-core.
Of course:
Maven:
...
<!-- Audit4j -->
<audit4j.version>2.4.0-alpha3</audit4j.version>
<audit4j-spring.version>2.4.0-alpha3</audit4j-spring.version>
<audit4j-db.version>2.3.1</audit4j-db.version>
...
<!-- Audit4j -->
<dependency>
<groupId>org.audit4j</groupId>
<artifactId>audit4j-core</artifactId>
<version>${audit4j.version}</version>
<exclusions>
<exclusion>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.audit4j</groupId>
<artifactId>audit4j-spring</artifactId>
<version>${audit4j-spring.version}</version>
</dependency>
<dependency>
<groupId>org.audit4j</groupId>
<artifactId>audit4j-db</artifactId>
<version>${audit4j-db.version}</version>
</dependency>
Spring:
<bean id="layout" class="org.audit4j.core.layout.SimpleLayout"></bean>
<bean id="metaData" class="ru.atc.tmon.core.audit.AuditMetaData"></bean>
<bean id="consoleAuditHandler" class="org.audit4j.core.handler.ConsoleAuditHandler"></bean>
<bean id="databaseAuditHandler" class="org.audit4j.handler.db.DatabaseAuditHandler">
<property name="embedded" value="false"></property>
<property name="db_connection_type" value="pooled"></property>
<property name="db_driver" value="${jdbc.driverClassName}"/>
<property name="db_url" value="${jdbc.url}"/>
<property name="db_user" value="${jdbc.username}"/>
<property name="db_password" value="${jdbc.password}"/>
</bean>
<bean id="auditconfig" class="org.audit4j.integration.spring.SpringAudit4jConfig">
<property name="layout" ref="layout"></property>
<property name="metaData" ref="metaData"></property>
<property name="handlers">
<list>
<ref bean="consoleAuditHandler"/>
<ref bean="databaseAuditHandler"/>
</list>
</property>
</bean>
<bean id="auditAspect" class="org.audit4j.integration.spring.AuditAspect" />
<aop:aspectj-autoproxy>
<aop:include name="auditAspect" />
</aop:aspectj-autoproxy>
MetaData:
public class AuditMetaData implements MetaData {
private static final long serialVersionUID = -991195007439661187L;
@Override
public String getOrigin() {
try {
return ((ServletRequest)((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()).getRemoteAddr();
}catch(Exception e){
System.out.println(e);
}
return null;
}
@Override
public String getActor() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null && authentication.getPrincipal() instanceof LoggedUser) {
return ((LoggedUser) authentication.getPrincipal()).getUsername();
}
return "anonymous";
}
}
Something else?
from audit4j-core.
Only 14 records and no one new :(
from audit4j-core.
Hi @msamichev
Is there any exception in console log? Are those audit records available in the console which are logged through console handler?
from audit4j-core.
No errors. But my second question, I don't see any audit information in console :(.
from audit4j-core.
And after restart tomcat new 14 records are created in table.
from audit4j-core.
Please remove the database handler from the configurations and share the console log. I want to check whether the issue is in the database handler.
from audit4j-core.
commented out db-handler and console started work:
_ _ _ _ _ _ _
/ \ _ _ __| (_) |_| || | (_)
/ _ \| | | |/ _` | | __| || |_| |
/ ___ \ |_| | (_| | | |_|__ _| |
/_/ \_\__,_|\__,_|_|\__| |_|_/ |
|__/
===========================(v2.4.0-alpha3)
Audit4j:INFO Initializing Audit4j...
Audit4j:INFO Loading Configurations...
Audit4j:INFO Validating Configurations...
Audit4j:INFO Initializing Handlers...
Audit4j:INFO org.audit4j.core.handler.ConsoleAuditHandler Initialized.
Audit4j:INFO Initializing Layout...
Audit4j:INFO org.audit4j.core.layout.SimpleLayout Initialized.
Audit4j:INFO Initializing Streams...
Audit4j:INFO Audit Streams Initialized.
Audit4j:INFO Executing Schedulers...
Audit4j:INFO Audit4j initialized. Total time: 447ms
...
10/22/2015 12:50:00|anonymous|null|loadUserByUsername==>arg0 java.lang.String:admin,
10/22/2015 12:50:00|admin|0:0:0:0:0:0:0:1|getCurrentUser==>
10/22/2015 12:51:18|admin|0:0:0:0:0:0:0:1|getCurrentUser==>
10/22/2015 12:51:26|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:52:01|admin|0:0:0:0:0:0:0:1|get==>arg0 java.lang.Integer:100004,
10/22/2015 12:52:01|admin|0:0:0:0:0:0:0:1|save==>arg0 ru.atc.tmon.core.model.user.User:User{id=100004, name='oke', email='[email protected]', password='$2a$10$g5EgGlW5XpCuR7yi3bQzKOaXSmqzAqAr/QD97kRjdoKGSmb1eO7yy', enabled=true, ldap=false, userProfile=UserProfile{id=500004, lastName='Краскин', firstName='Олег', middleName=''}, registered=2015-10-22 12:49:44.801, roles=[Role{id=200002, name='ROLE_INSPECTOR', description='налоговый инспектор', permissions='[Permission{id=400000, name='SELECT'}]'}, Role{id=200000, name='ROLE_USER', description='сотрудник налогоплательщика', permissions='[Permission{id=400000, name='SELECT'}]'}], groups=[]},
10/22/2015 12:52:01|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:52:02|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:52:54|admin|0:0:0:0:0:0:0:1|get==>arg0 java.lang.Integer:100004,
10/22/2015 12:52:54|admin|0:0:0:0:0:0:0:1|save==>arg0 ru.atc.tmon.core.model.user.User:User{id=100004, name='oke', email='[email protected]', password='$2a$10$g5EgGlW5XpCuR7yi3bQzKOaXSmqzAqAr/QD97kRjdoKGSmb1eO7yy', enabled=true, ldap=false, userProfile=UserProfile{id=500004, lastName='Краскин', firstName='Олег', middleName=''}, registered=2015-10-22 12:49:44.801, roles=[], groups=[]},
10/22/2015 12:52:54|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:52:54|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:53:37|admin|0:0:0:0:0:0:0:1|delete==>arg0 java.lang.Integer:100004,
10/22/2015 12:53:37|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:53:37|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:53:37|admin|0:0:0:0:0:0:0:1|delete==>arg0 java.lang.Integer:100004,
10/22/2015 12:53:37|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:53:37|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:54:07|admin|0:0:0:0:0:0:0:1|get==>arg0 java.lang.Integer:100005,
10/22/2015 12:54:07|admin|0:0:0:0:0:0:0:1|save==>arg0 ru.atc.tmon.core.model.user.User:User{id=100005, name='vsmys', email='[email protected]', password='$2a$10$BJvYcfI.ZUxod9AjrRLv2uwLfbBtaA6HyvFhfsmmQmghXoYTtj2La', enabled=true, ldap=false, userProfile=UserProfile{id=500005, lastName='Смыслов', firstName='Василий', middleName=''}, registered=2015-10-22 12:49:44.801, roles=[Role{id=200001, name='ROLE_ADMIN', description='администратор', permissions='[Permission{id=400001, name='CREATE'}, Permission{id=400003, name='DELETE'}, Permission{id=400000, name='SELECT'}, Permission{id=400002, name='UPDATE'}]'}, Role{id=200002, name='ROLE_INSPECTOR', description='налоговый инспектор', permissions='[Permission{id=400000, name='SELECT'}]'}], groups=[]},
10/22/2015 12:54:07|admin|0:0:0:0:0:0:0:1|getAll==>
10/22/2015 12:54:07|admin|0:0:0:0:0:0:0:1|getAll==>
from audit4j-core.
I think there will be an issue in database handler. I suspect that the connections in the database pool are not releasing again to the pool after consume by the application. Can you switch it to single connection mode or jndi mode for now and let me know how it is going. I will fix this issue later.
from audit4j-core.
Put single mode - it works(both handlers), thanks.
when can we expect a version with pool mode?
from audit4j-core.
We will release this in database handler 2.4.0 version by next week.
from audit4j-core.
cool. will wait ;)
from audit4j-core.
One request - can you add datasource property in db-handler or it is difficult?
from audit4j-core.
Yes. It is pretty straight forward but we have to test it since the handlers are working outside the application context scope because of the asynchronous nature. I will add this to our milestone and plan a release in next major version.
from audit4j-core.
Fixed issue in Audit4j-DB 2.4.0-alpha1 and currently available in maven central repository.
Added external data source support.
from audit4j-core.
Related Issues (20)
- Throw statement in YAMLConfigProvider drops exception on floor
- How to extends the Customizable Layout (example add ${roles}) HOT 1
- Dependencies number HOT 3
- Success Call or Failure Call
- Update @AuditField documentation HOT 3
- Errors after running Application HOT 7
- 2.5.0 Config with YAML file CustomizableLayout : pb properties dateFormat and template HOT 1
- Audit4j still uses older group of javassist HOT 2
- Initialization vectors should be randomly generated for proper security guarantees.
- Timestamp format for database auditing HOT 1
- @Audit annotation does not work HOT 4
- Support for loading config file from user home directory HOT 1
- It is not possible to change the prefix of the Audit file (FileAuditHandler auditFilePrefix not taken in account)
- Support for wildcard file filter
- isJDK_N_OrHigher() method having issue with Java 10 HOT 5
- Java 10 compatibility Issue HOT 14
- audit4j-core 2.6.0 with Maven HOT 1
- Bug with async mode is always true
- ZeroCopyFileWriter leaks file handlers
- Webiste audit4j.org down HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audit4j-core.