[Installation, Configuration & DEPLOYMENT] - Re: TRACE level doesn't work
by jaikiran
Tried this on my local setup with JBoss-4.2.2. Got it working. Here's what you have to do:
1) Create a log4j.properties file and package it with your application and make it available in the classpath (i placed the log4j.properties file at the root of the EAR file). The log4j.properties looks like:
log4j.logger.org.myapp=TRACE
2) Also package the appropriate version of log4j jar with your application (this step and the next step are important because you will have to ensure that log4j initializes separately for your application and picks up the log4j.properties file). Place this log4j jar file in the application package so that it is made available in the classpath (i placed it in a folder named lib of the EAR file - remember that any jars in the lib folder of the EAR are by default added to the classpath and made available to the entire application, starting JBoss-4.2.x version).
3) Enable classloader isolation for your application. This is necessary as explained in step#2. You will have to create a jboss-app.xml file and place it in the META-INF folder of the EAR. The jboss-app.xml looks like:
| <jboss-app>
| <loader-repository>
| org.myapp:loader=MyClassLoader
| <loader-repository-config>
| java2ParentDelegation=false
| </loader-repository-config>
| </loader-repository>
|
|
|
| </jboss-app>
This is how my EAR file looks like:
myApp.ear
| |
| |--- log4j.properties
| |
| |--- META-INF
| | |
| | |--- application.xml
| | |
| | |--- jboss-app.xml
| |
| |--- lib
| | |
| | |--- log4jxxx.jar
And finally the -Dlo4j.debug prints out the following message when i invoke my application (this is just a sample output):
| 2008-02-01 13:24:01,231 INFO [STDOUT] log4j: Trying to find [log4j.xml] using context classloader org.jboss.mx.loading.UnifiedClassLoader3@1038b78{ url=file:/D:/JBoss-4.2.2/jboss-4.2.2.GA/server/jaikiran/deploy/EJB3Persistence.ear/ ,addedOrder=45}.
| 2008-02-01 13:24:01,247 INFO [STDOUT] log4j: Trying to find [log4j.xml] using org.jboss.mx.loading.UnifiedClassLoader3@1038b78{ url=file:/D:/JBoss-4.2.2/jboss-4.2.2.GA/server/jaikiran/deploy/EJB3Persistence.ear/ ,addedOrder=45} class loader.
| 2008-02-01 13:24:01,262 INFO [STDOUT] log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
| 2008-02-01 13:24:01,262 INFO [STDOUT] log4j: Trying to find [log4j.properties] using context classloader org.jboss.mx.loading.UnifiedClassLoader3@1038b78{ url=file:/D:/JBoss-4.2.2/jboss-4.2.2.GA/server/jaikiran/deploy/EJB3Persistence.ear/ ,addedOrder=45}.
| 2008-02-01 13:24:01,262 INFO [STDOUT] log4j: Using URL [file:/D:/JBoss-4.2.2/jboss-4.2.2.GA/server/jaikiran/deploy/EJB3Persistence.ear/log4j.properties] for automatic log4j configuration.
| 2008-02-01 13:24:01,262 INFO [STDOUT] log4j: Reading configuration from URL file:/D:/JBoss-4.2.2/jboss-4.2.2.GA/server/jaikiran/deploy/EJB3Persistence.ear/log4j.properties
| 2008-02-01 13:24:01,262 INFO [STDOUT] log4j: Parsing for [root] with value=[DEBUG, stdout, logfile].
| 2008-02-01 13:24:01,262 INFO [STDOUT] log4j: Level token is [DEBUG].
| 2008-02-01 13:24:01,262 INFO [STDOUT] log4j: Category root set to DEBUG
| 2008-02-01 13:24:01,278 INFO [STDOUT] log4j: Parsing appender named "stdout".
| 2008-02-01 13:24:01,309 INFO [STDOUT] log4j: Parsing layout options for "stdout".
| 2008-02-01 13:24:01,309 INFO [STDOUT] log4j: Setting property [conversionPattern] to [%d %p [%c] - <%m>%n].
| 2008-02-01 13:24:01,325 INFO [STDOUT] log4j: End of parsing for "stdout".
| 2008-02-01 13:24:01,325 INFO [STDOUT] log4j: Parsed "stdout" options.
| 2008-02-01 13:24:01,325 INFO [STDOUT] log4j: Parsing appender named "logfile".
| 2008-02-01 13:24:01,325 INFO [STDOUT] log4j: Parsing layout options for "logfile".
| 2008-02-01 13:24:01,325 INFO [STDOUT] log4j: Setting property [conversionPattern] to [%d %p [%c] - %m%n].
| 2008-02-01 13:24:01,325 INFO [STDOUT] log4j: End of parsing for "logfile".
| 2008-02-01 13:24:01,340 INFO [STDOUT] log4j: Setting property [file] to [D:\JBoss-4.2.2\jboss-4.2.2.GA\server\jaikiran\log\test.log].
| 2008-02-01 13:24:01,340 INFO [STDOUT] log4j: Setting property [maxFileSize] to [512KB].
| 2008-02-01 13:24:01,340 INFO [STDOUT] log4j: Setting property [maxBackupIndex] to [3].
| 2008-02-01 13:24:01,340 INFO [STDOUT] log4j: setFile called: D:\JBoss-4.2.2\jboss-4.2.2.GA\server\jaikiran\log\test.log, true
| 2008-02-01 13:24:01,356 INFO [STDOUT] log4j: setFile ended
| 2008-02-01 13:24:01,356 INFO [STDOUT] log4j: Parsed "logfile" options.
| 2008-02-01 13:24:01,356 INFO [STDOUT] log4j: Parsing for [org.myapp] with value=[WARN].
| 2008-02-01 13:24:01,356 INFO [STDOUT] log4j: Level token is [WARN].
| 2008-02-01 13:24:01,356 INFO [STDOUT] log4j: Category org.myapp set to WARN
| 2008-02-01 13:24:01,356 INFO [STDOUT] log4j: Handling log4j.additivity.org.myapp=[null]
| 2008-02-01 13:24:01,356 INFO [STDOUT] log4j: Finished configuring.
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125416#4125416
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4125416
18 years, 2 months
[JBoss Seam] - Re: How to prevent page data reloading when click Back
by arvhatte
Hi gus888,
By default your browser shows you a page from its cache when you press the back button in your browser, except when that page has accepted POSTDATA, so was requested with the POST method instead of the GET method. The POST method is (generally) used when submitting form data en the GET method is (generally) used when simply retrieving information. In Seam the POST method is also used to propagate the conversation id (see http://labs.jboss.com/jbossseam/faq/#get, so if you try to go back to a page where you posted data or when in a conversation scope, your browser will try to re-post the data and therefore hit your server again, causing your data to be reloaded.
You can of course prevent this by making use of 'redirect' in your pages.xml to redirect to the new page after the POST is finished (basically accepting the POST, and then doing a new GET request to the new page). Another approach might be by storing data in a wider scope, which would still make a call to the server (when pressing the back button), but because the data is still present, it won't refetch that data from the database.
Hope this was helpful, if not, please let me know by replying again. If possible, also include your pages.xml and the two backing beans of the pages you're navigating between by using the back button.
Greetings,
Tim
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125411#4125411
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4125411
18 years, 2 months