How do I enable logging in Scalardb? Does it support logback? The ScalarDB logic in my application is throwing NullPointerException. I want to enable traces to understand where the problem might be.
Scalar DB uses slfj4 so various logging frameworks such as logback and log4j can be used.
https://github.com/scalar-labs/scalardb/blob/master/build.gradle
You need to build your application with such logging frameworks and configure
them properly.
For more information regarding slf4j, please refer to slf4j site.
This seem to work - <logger name="com.scalar" level="DEBUG" additivity="true"> <appender-ref ref="STDOUT"/> </logger>
Related
we are deploying a Java web application in JBoss 7.. 3 EAP.
We need to enable set the debug level for some specific classes (i.e. org.mycompany.mypackage).
As described here:
https://logging.apache.org/log4j/2.x/manual/configuration.html
just setting the environment variable
LOG4J_DEBUG
the log level is set to debug for whole system.
We wonder if there is a way to do it for specific classes/packages
Thank in advance
r.
The LOG4J_DEBUG environment variable does not enable debug logging for your application. It enables debug logging for the internals of Log4j 2. You set the default logging level for your applicaton by specifying a level on the Root Logger.
<Loggers>
<Root leve="info">
<Appender-Ref ref="Console"/>
</Root>
</Loggers>
You could change this so that the default level can be set from an environment variable by doing:
<Loggers>
<Root leve="${env:DEFAULT_LEVEL:-INFO}">
<Appender-Ref ref="Console"/>
</Root>
</Loggers>
The way to set the logging level for specific classes or Packages is to use a log4j configuration file as described in that same section. If you want the levels to be configured via environment variables then you can do that by doing something like:
<Logger name="com.mycorp.myservice.dao" level="${env:DAO_LEVEL:-WARN}"\>
This will use a default value of WARN if the environment variable named DAO_LEVEL is not present.
I want to prevent usage of ejb3 in my system, so I want to remove ejb3 subsystem from standalone.xml:
<subsystem xmlns="urn:jboss:domain:ejb3:1.2">
…
</subsystem>
What additional functionality I will miss in addition to ejb3?
You wont loose anything beyond ejb3.
I just spent a half hour debugging some new code that's not broken because I forgot to check (again!) my logs for this dreaded message:
WARN openjpa.Enhance - Creating subclass for ...
I'm running OpenJPA 2.1.0 inside an OpenEJB 3.2 snapshot build, Java 1.6.0_25, and Eclipse Helios. My entities are enhanced using the ant PCEnhancerTask.
My META-INF/openjpa.xml contains
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />
<property name="openjpa.DynamicEnhancementAgent" value="false" />
Is there anyway with this EE configuration to have OpenJPA enforce the RuntimeUnenhancedClasses option as it does in an SE configuration?
I suspect my 'real' problem stems from an Eclipse svn update that sometimes touches my JPA entity source, causing a build that overwrites my enhanced classes.
It's frustrating how often I run a unit test from the IDE that fails in some weird way, and I go digging through my code looking for a problem when all I need to do is run the enhancer.
Put the <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" /> META-INF/persistence.xml.
Looks like we're logging this action on debug level (maybe it should be info level), but OpenEJB will set that property to the default as it was in OpenJPA 1.x so that apps that worked with OpenEJB 3.1.x/OpenJPA 1.x will still work without modification in 3.2.x. If the property is already set in the persistence.xml it will never be overridden, so setting it there will have the effect you want.
Open to suggestions on how to save others in the same boat some time in the future. Seems either looking in the openjpa.xml file and seeing the property set already or issuing the log message on info would do it -- or both.
It sounds like for whatever reason your properties aren't being picked up when running in the container.
I have a number of possible solutions:
Try setting your properties in META-INF/persistence.xml. I assume you have these properties in the openjpa.xml file for a reason, but it might help us figure out where the real problem is.
Set -Dopenjpa.RuntimeUnenhancedClasses=false as a JVM property. This will apply to all PUs for a given JVM.
Move to a version of OpenJPA that is >= 2.0.0. RuntimeUnenhancedClasses was turned off as the default behavior in that release.
I am creating an application using spring batch in which i am reading data from database and populate it in a file placed in D drive. My application does not have any errors but when i run my app, the console does not show any exceptions. In fact, the console is blank completely. I am not able to figure out if the app is actually getting executed or not.
I am using CommandLineJobRunner class for executing my job.
All your comments would be of great help.
Thanks
Reading data from database and populate it in a file placed in D drive
I am not able to figure out if the app is actually getting executed or not
Did you check the D drive? Is the file there? Was it populated as expected?
As a rule of thumb => write a test, that would make sure the file is there on the D drive, and that it has all the data expected. But as a start, you can just check it manually.
As to your question => The reason that you do not see anything, is most likely related to the logging misconfiguration.
If you use log4j / slf4j / etc, make sure to place a default (for a start) lo4j.properties / lo4j.xml file in your class path [e.g. root of your project]. If you use logback, make sure a logback.xml is in your classpath with (for a start) default configuration:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
<logger name="org.root.level.package" level="debug"/>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
Did you develop your application using an IDE like Eclipse? If so, you might try debugging your code so that you can find out the reason why your application is not working as you expected it to be.
I am currently developing an EJB 3.0 based application on the JBoss AS 5.0.0.GA and just recently the following warning showed up in the server log:
09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
09:50:19,735 WARN [InterceptorRegistry] applicable interceptors is non-existent for ...
...
The warnings are generated as soon as an EJB (a stateless session bean) is injected into a backing bean of my JSF web-application. The beans do work without problems though, but I still would like to know where that warning comes from and what I can do to avoid it.
I have already searched a bit around, but haven't found a good answer (some say, bean developers do not have to worry, but its a warning, so I'd like to have a better solution):
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=147292
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180366
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140136
JBoss JIRA Issue about the warning (Not that helpful in my opinion)
So has anyone an explanation what causes the warning (in terms of a bean developer, not application server developer) and what to do to avoid it?
Update: I've just upgraded JBoss to 5.0.1.GA (Download, Release-Notes) but unfortunatly the warning still appears.
As far as I understand all the available sources on this warning, it is nothing a user of JBoss 5 can do anything about and is essentially just a reminder for the developers of JBoss that they use their own classes wrong.
Following the advice from the developers, I am now ignoring it by changing my logging configuration in conf/jboss-log4j.xml. I've just added:
<category name="org.jboss.ejb3.interceptors">
<priority value="ERROR" />
</category>
Even the JBoss EJB3 tutorial/documentation says you can safely ignore these warnings. Well if everyone can ignore these don't log them! It's frustrating to see this issue isn't being fixed.
I had the same problem, modify the ejb3-interceptors-aop.xml, and now works ok.
I've tried this modification in ejb3-interceptors-aop.xml
I've comment these lines :
<aspect name="InterceptorsFactory" factory="org.jboss.ejb3.interceptors.aop.InterceptorsFactory" scope="PER_INSTANCE"/>
<advice name="invoke" aspect="InterceptorsFactory"/>
and it Works
The warnings no longer appear in JBoss 5.1.0, but adding the category as Simon posted eliminates the logging of the warnings in 5.0.x
Just follow the steps
Stop JBoss and right click on the server instance and select clean
right click on the project and select run -> run configurations
select classpath -> add jars
Add Jars from JBoss ASHOME/client - jbossall-client.jar,JBoss ASHome/common/lib - all jars.
Apply and run.