Sample log4j property file, logging only to file, if you want console add 'stdout' in the rootlogger and remove the comments in the section below.
I included hibernate and spring logging relevant
# Root logger option
log4j.rootLogger=INFO, file
log4j.category.com=WARN
log4j.category.org=WARN
log4j.category.com.softweave=DEBUG
log4j.category.org.springframework=INFO
#log4j.category.org.springframework.beans.factory=INFO
#log4j.category.org.springframework.beans.factory.support=INFO
log4j.category.org.apache.cxf.service.factory.ReflectionServiceFactoryBean=WARN
log4j.category.org.hibernate.hql.internal.ast.HqlSqlWalker=ERROR
log4j.category.org.hibernate.SQL=INFO
# To see hibernate parameters in the query and not just ? you must set this to TRACE
log4j.category.org.hibernate.type=INFO
log4j.category.org.hibernate.tool.hbm2ddl=INFO
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=log_file_name_and_location.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %c{1}:%L - %m%n
# Direct log messages to stdout
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.Target=System.out
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - #%m%n
# spring transaction log
log4j.logger.org.springframework.orm.jpa=INFO
log4j.logger.org.springframework.transaction=INFO
#log4j.logger.org.springframework.orm.hibernate3.HibernateTransactionManager=DEBUG
# hibernate full details log
log4j.logger.org.hibernate=INFO
#log4j.logger.org.hibernate.type=trace
Showing posts with label spring. Show all posts
Showing posts with label spring. Show all posts
Jun 5, 2014
log4j.properties
Labels:
apache,
appender,
category,
consoleappender,
conversionpattern,
hbm2ddl,
hibernate,
hibernate3,
log4j,
log4j.properties,
logger,
patternlayout,
rollingfileappender,
spring,
springframework,
stdout
May 21, 2014
NoClassDefFoundError: jersey/repackaged/com/google/common/collect/Maps
Hi,
I am working with spring 4.0.4 and jersey 2.7 and Gradle 1.11 suddelny out of nowhere i build and deployed to my tomcat 7 (latest release) and got the above error.
Worked to figure out what went wrong about an hour.
Than i saw that they released a new 2.8 lately, decided to try it - it worked +
Problem solved for me after upgrading from jersey 2.7 to 2.8
and adding this to my gradle dependencies
"org.glassfish.jersey.bundles.repackaged:jersey-guava:2.8"
Hopefully it will help you too,
Dor
I am working with spring 4.0.4 and jersey 2.7 and Gradle 1.11 suddelny out of nowhere i build and deployed to my tomcat 7 (latest release) and got the above error.
Worked to figure out what went wrong about an hour.
Than i saw that they released a new 2.8 lately, decided to try it - it worked +
Problem solved for me after upgrading from jersey 2.7 to 2.8
and adding this to my gradle dependencies
"org.glassfish.jersey.bundles.repackaged:jersey-guava:2.8"
Hopefully it will help you too,
Dor
Dec 27, 2012
EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0
Hi,
Lately i had this exception in my spring jdbc part of code. What it
actually means is that your query probably doesn't return any value while you are trying to assign the query result into let's say 'int'.
Change the query from queryForInt to regular query that returns a list. Use row mapper also.
Check the list, if it's empty, nothing returned from the query, decide what to do, else if the list isn't empty
and contain data, also, decide what to do.
It then will work for you.
Hoped i helped,
Dor
Lately i had this exception in my spring jdbc part of code. What it
actually means is that your query probably doesn't return any value while you are trying to assign the query result into let's say 'int'.
Change the query from queryForInt to regular query that returns a list. Use row mapper also.
Check the list, if it's empty, nothing returned from the query, decide what to do, else if the list isn't empty
and contain data, also, decide what to do.
It then will work for you.
Hoped i helped,
Dor
Jul 9, 2012
Spring Hibernate Envers java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(I)V
Issue occurred to my college at work. It means that spring uses already the envers as a dependency inside it and you are trying to add it also with a different version. As result -> Conflict.
For me it happened with
spring 3.0.5
hibernate 3.6.0.FINAL
* We added hibernate-envers 3.6.0.FINAL.
Solution
Replacing hibernate-envers with the latest, current latest is 4.1.4 but you should look in maven repository.
For me it happened with
spring 3.0.5
hibernate 3.6.0.FINAL
* We added hibernate-envers 3.6.0.FINAL.
Solution
Replacing hibernate-envers with the latest, current latest is 4.1.4 but you should look in maven repository.
Apr 18, 2012
junit NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
Got this error while trying to run one of my junits.
This junit annotated with spring annotations and works with spring-web3.0.5-RELEASE.
After a lot of digging, it seems that the issue is simple.
You need to add this to your pom :
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.4.2</version>
</dependency>
Jackson 1.4.2 suite to spring-web3.0.5
Problem caused since the jackson dependency in spring-web is an optional=true.
This junit annotated with spring annotations and works with spring-web3.0.5-RELEASE.
After a lot of digging, it seems that the issue is simple.
You need to add this to your pom :
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.4.2</version>
</dependency>
Jackson 1.4.2 suite to spring-web3.0.5
Problem caused since the jackson dependency in spring-web is an optional=true.
Jan 6, 2011
java.lang.ClassNotFoundException: javassist.util.proxy.MethodFilter
I got this error while using maven, jetty, wicket, spring and hibernate all with annotations.
Found two solutions
1) Get the java assist jar using maven, but them i got into some other problems.
2) Use this :
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
</dependency>
It seems that it solved the issue since the jaxrs contains this method filter.
If you know other or better solution, i am here to listen.
Hoped it helped,
Dor
Found two solutions
1) Get the java assist jar using maven, but them i got into some other problems.
2) Use this :
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
</dependency>
It seems that it solved the issue since the jaxrs contains this method filter.
If you know other or better solution, i am here to listen.
Hoped it helped,
Dor
Jan 4, 2011
addComponentInstantiationListener in wicket 1.5
Hi,
In 1.4 we could do this : addComponentInstantiationListener(springInjector);
The only solution that i found in 1.5 M3 is calling the super and doing this like:
super.getComponentInstantiationListeners().add(springInjector);
Maybe in later versions it will be more easy.
Wicket in Action
In 1.4 we could do this : addComponentInstantiationListener(springInjector);
The only solution that i found in 1.5 M3 is calling the super and doing this like:
super.getComponentInstantiationListeners().add(springInjector);
Maybe in later versions it will be more easy.
Wicket in Action
Nov 23, 2010
Initializing LdapContextSource localy instead of using spring xml
If you decide to work with internal coded LdapContextSource initialize instead of using spring injection (external application context xml file). There is one important thing you shouldn't forget:
Call "afterPropertiesSet()" method to finish up initialization.
Failing to do so would probably led you to this failure / exception as i had:
"org.springframework.ldap.core.support.AbstractContextSource.getAuthenticatedEnv(AbstractContextSource.java:449) etc.."
Hopefully that this helps...
Dor
Call "afterPropertiesSet()" method to finish up initialization.
Failing to do so would probably led you to this failure / exception as i had:
"org.springframework.ldap.core.support.AbstractContextSource.getAuthenticatedEnv(AbstractContextSource.java:449) etc.."
Hopefully that this helps...
Dor
Spring LDAP dynamic connecting
Hi,
Lately i saw a question in one of spring ldap forums, were one of guys there asked this question:
How can i connect ldap without using spring xml (application context xml file).
My answer to him was that that i prefer and need in my project to use it dynamically intead of known configuration that can be configured in spring application context file (beans).
This was my solution for him:
LdapContextSource ldapContextSource = new LdapContextSource();
ldapContextSource.setUrl("ldap://localhost:portnumber");
ldapContextSource.setBase("ou=users, ou=system");//*
ldapContextSource.setUserDn("username to connect");
ldapContextSource.setPassword("password");
ldapContextSource.afterPropertiesSet();
//* the base is not necessary needed, it depends what do you need.
Bye,
Dor
Lately i saw a question in one of spring ldap forums, were one of guys there asked this question:
How can i connect ldap without using spring xml (application context xml file).
My answer to him was that that i prefer and need in my project to use it dynamically intead of known configuration that can be configured in spring application context file (beans).
This was my solution for him:
LdapContextSource ldapContextSource = new LdapContextSource();
ldapContextSource.setUrl("ldap://localhost:portnumber");
ldapContextSource.setBase("ou=users, ou=system");//*
ldapContextSource.setUserDn("username to connect");
ldapContextSource.setPassword("password");
ldapContextSource.afterPropertiesSet();
//* the base is not necessary needed, it depends what do you need.
Bye,
Dor
Subscribe to:
Posts (Atom)