[jboss-user] [JBoss Seam] - Using an @Logger instance outside of a SEAM POJO

DataGazetteer do-not-reply at jboss.com
Thu Dec 14 13:35:07 EST 2006


I have a feeling I'm doing something very wrong with respect to passing a reference to a log to a non-SEAM object.  What happens (running under JBoss AS 4.0.5) is that the first time the non-SEAM object tries to use a log method all log output from the container stops.  The application keeps running, and in fact I can remove and add the SEAM application in the deploy directory and have it redeploy but still get no logging output.

Here is fragments of the code from the SEAM app.  First, the SEAM-enabled session bean.


  | @Stateful
  | @Name("search")
  | @Scope(ScopeType.SESSION)
  | public class SearchAction implements Search {
  | 
  | 	@Logger
  | 	private Log log;
  | 
  | 	@In
  | 	ParamStore paramStore;
  | 
  | 	public String search() throws Exception {
  | 		paramStore.setLog(log);
  | 		log.info("search.search() action called with: #0", q);
  | 		SearchSvc searchSvc = new searchSvc();
  | 		List<String> matchingIds = searchSvc.search(paramStore, q);
  | 

Next, 'ParamStore' which holds the 'log' value.  This is not an SEAM entity bean (e.g., it does not have the @Entity annotation), just a normal JavaBean.


  | public class ParamStore {
  | 
  |     private Log log;   
  |     
  |     public ParamStor() { }
  | 
  |     public Log getLog() {
  |         return log;
  |     }
  |     
  |     public void setLog(Log log) {
  |         this.log = log;
  |     }
  | }
  | 

And finally a non-SEAM object that tries to make use of it.


  | public class SearchSvc {
  | 
  | 	public List<String> search(ParamStore paramStore, String query)
  | 			throws Exception {
  | 		
  | 		Log log=paramStore.getLog();
  | 		log.warn("This'll never be seen. #0", "And subsequent log messages are not seen.");
  | 	}
  | }
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993974#3993974

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993974



More information about the jboss-user mailing list