tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "siegfried" <siegfr...@heintze.com>
Subject RE: How to log in EJB
Date Tue, 26 May 2009 07:40:09 GMT

>Is there something different that you would like?  Sure we can find a
>way to do what you need if we can get a better picture of what you're
>after.
>
>-David

I've edited
openejb-examples-3.1\simple-stateless\src\main\java\org\superbiz\calculator\
CalculatorImpl.java
and added the line of code log.info("calling sum"); See below for the entire
file with my edits.

This is working as desired and I see "calling sum" when I type "mvn test".

However, when I use log.fine("calling sum") it does not work. Somewhere
there is a properties file I need
(1) bundle in the deployment using the pom.xml (how do I do that?)
(2) modify to turn on fine grain logging for CalculatorImpl (how do I do
that?)

Why does not the standard logging API have a function called debug instead
of fine?

Could I use the log4j implementation too?

Thanks,
Siegfried

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.superbiz.calculator;

import javax.ejb.Stateless;
import java.util.logging.*;

/**
 * This is an EJB 3 style pojo stateless session bean
 * Every stateless session bean implementation must be annotated
 * using the annotation @Stateless
 * This EJB has 2 business interfaces: CalculatorRemote, a remote business
 * interface, and CalculatorLocal, a local business interface
 * 
 */
//START SNIPPET: code
@Stateless
public class CalculatorImpl implements CalculatorRemote, CalculatorLocal {
  private static Logger log =
Logger.getLogger(CalculatorImpl.class.getName());

	public int sum(int add1, int add2) {
    log.info("calling sum");
		return add1+add2;
	}

	public int multiply(int mul1, int mul2) {
    log.info("calling multiply");
		return mul1*mul2;
	}

}
//END SNIPPET: code

Mime
View raw message