On Sep 13, 2013, at 10:26 AM, Francesco Chicchiriccò wrote: > Hi all, > I am trying to configure a JDBCAppender in log4j 2.0-beta9-SNAPSHOT, with a > pre-existing DataSource managed via Spring; such DataSource is used by the > rest of Syncope. > > I have tried, without success. to provide a custom ConnectionSource or a > ConnectionFactory: the point is that, when log4j2 initializes, the Spring > context is yet to be built, hence no beans (including the DataSource > referenced above) are available. > > I have read from [1] that log4j2 features an "automatic configuration": is > there any way to disable it and invoke it manually later?
You don't want to do this, because you could miss important logging events. What happens if there is some failure in Spring that doesn't get logged because you delayed configuration? You always want Log4j to start before anything else in your application; otherwise, you could miss important events. Could you tell me a little bit more exactly how your DataSource is "spring-managed?" This isn't exactly clear to me. Are you actually using Spring Framework to create the DataSource somehow? If so, what Spring Framework feature/classes are you using? If Spring Framework has to start in order to create your DataSource, this is going to be a problem because logging will start too late. There is definitely a way to get this working, and I can help you, I just need a little better understanding of exactly how you're creating and distributing the DataSource. Nick > Thanks for your support. > Regards. > > [1] > http://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration > > -- > Francesco Chicchiriccò > > ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member > http://people.apache.org/~ilgrosso/ >
smime.p7s
Description: S/MIME cryptographic signature
