I solved the problem of Log4j warnings with the following code.
import java.rmi.RemoteException;
import java.util.Properties;
import javax.naming.*;
import javax.ejb.*;
import javax.rmi.PortableRemoteObject;
import org.apache.log4j.*;
public class Client
{
private static final String JNDI_NAME = "st.hello";
static Logger logger;
public static void main(String[] args) throws Exception
{
logger = Logger.getRootLogger();
logger.addAppender(new FileAppender( new HTMLLayout(), "log.html",true));
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
h.put(Context.PROVIDER_URL, "localhost:1099");
h.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
Context ctx = new InitialContext(h);
HelloHome home = (HelloHome ) ctx.lookup(JNDI_NAME);
Hello hello = home.create();
System.out.println(hello.sayHello("Srikanth"));
}
}
It is writing the log into a HTML file called log.html.
P.Srikanth.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3931401#3931401
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3931401
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user