-
1. Re: Log SQL statement
ohadraz Oct 26, 2005 3:48 PM (in response to ohadraz)OK, I've found the answer:
First of all, since my question was not clear enough, let me explain:
JBoss logs SQL statements in the server.log (which is located in the \log directory of the server's directory (e.g., %JBOSS_HOME%\server\default\log); what I wanted was to make a separate log file for the SQL statements.
So, how to do it?
A modification is needed in the log4j.xml file (which is located in the \conf directory of the server's directory).
There should be added an appender, and a category elements.
Let's say that the I want to name of the new log file "SQLs.log", so, the modification that should be made in the log4j.xml file are as follows:<!-- ================================================= --> <!-- Append SQL generated by JBoss CMP to the log file --> <!-- ================================================= --> <appender name="CMP" class="org.jboss.logging.appender.RollingFileAppender"> <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <param name="File" value="${jboss.server.home.dir}/log/SQLs.log"/> <param name="Append" value="false"/> <param name="MaxFileSize" value="500KB"/> <param name="MaxBackupIndex" value="1"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/> </layout> </appender> <!-- Limit the org.jboss.ejb.plugins.cmp category to DEBUG --> <category name="org.jboss.ejb.plugins.cmp"> <priority value="DEBUG" /> <appender-ref ref="CMP"/> </category>
And that does the trick!!! -
2. Re: Log SQL statement
yashgarg Apr 21, 2011 10:55 AM (in response to ohadraz)but its not logging the SQLs for Jboss Messaging? do you have any idea , how can I do that ?
-
3. Re: Log SQL statement
peterj Apr 21, 2011 11:01 AM (in response to yashgarg)Yash, you are replying to a post that is 6 years old! I doubt that the original poster was even using JBoss Messaging, probably the suggested solution was for JBossMQ. I don't think JBoss Messaging even existed back then.
-
4. Re: Log SQL statement
yashgarg Apr 21, 2011 11:55 AM (in response to peterj)Peter, Do you know how I can see the SQLs for Jboss messaging?
-
5. Re: Log SQL statement
peterj Apr 21, 2011 12:31 PM (in response to yashgarg)Not offhand. You can dig thru the source code to see if Messaging logs the SQL statements. Of you can turn Messaging logging to TRACE (add a categories for org.jboss.messaging and org.jboss.jms) and see if they show up.
If you just want to see the SQL statements used, they are in the server/xxx/deploy/messgaing/*-persistence-service.xml file.
-
6. Log SQL statement
yashgarg Apr 21, 2011 12:41 PM (in response to peterj)I have alredy added jms and messaging into log4j.xml , but its not showing the SQL Statements,
e.g. I am trying to get the status of the Queues with the following , its working fine but wanted to see the SQL Statements
invoke "dcm4chee.archive:service=JmsConsole" listQueueStatus