I'm trying to use gwt-log on my gwt application but I can't get any log message from this library( I don't know where should I found them) I have added these configuration to my gwt.xml file
<inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />
<extend-property name="log_level" values="DEBUG"/>
<set-property name="log_level" value="DEBUG"/>
<set-property name="log_DivLogger" value="DISABLED" />
and I have modified my entry point class as follows:
public void onModuleLoad() {
Log.setUncaughtExceptionHandler();
DeferredCommand.addCommand(new Command() {
public void execute() {
onModuleLoad2();
}
});
}
private void onModuleLoad2() {
if (!Log.isLoggingEnabled()) {
Window.alert("Logging is disabled. No log messages will appears.");
}
Log.trace("This is a 'TRACE' test message");
Log.debug("This is a 'DEBUG' test message");
Log.info("This is a 'INFO' test message");
Log.warn("This is a 'WARN' test message");
Log.error("This is a 'ERROR' test message");
Log.fatal("This is a 'FATAL' test message");
}
and I can get these messages printed on console but the problem is that I can't get any other message printed either in server side or in client side,So is there something I'm missing?
Thanks
You should be able to see them in the development console (Jetty container wrap), in hosted mode. You can find a log of all HTTP traffic + gwt logs for a specific "host".
I'm not exactly sure how you can forward them to write to an external destination for production mode, though you should be able.
Make sure you setup the required servlet in web.xml.
As a side note, if you are using GWT 2.1 or higher, you can start using the new Logging framework, which emulates Java's built-in logging framework.
Related
I'm trying to log into using MinecraftServer.logInfo(), but I get a nosuchmethod exception.
server.logInfo("Example message");
I'm getting the instance of MinecraftServer in the server starting event.
MinecraftServer server = event.getServer();
An option for a fully fledged logger is
Logger logger = LogManager.getLogger(YourMod.MODID);
I'm pretty sure a simple
System.out.println("Information!");
Should do in forge.
I want to send a mail notification in a java application via log4j. However the first try with configurated log4j.properties file, worked like charm. But since I want a dynamic subject, which is generated in runtime, I tried the following commands, with no success:
final static Logger logger = Logger.getRootLogger();
...
public static mail(String msg, String subj) {
SMTPAppender mailAppend = new SMTPAppender();
mailAppend.setBufferSize(3);
mailAppend.setSMTPHost("smtphostname");
mailAppend.setTo("ex#mple.com");
mailAppend.setSubject(subj);
logger.addAppender(mailAppend);
logger.error(msg);
}
output:
log4j:ERROR Message object not configured.
So did I miss a necessary getter?
An SMTPAppender can be configured either using a xml or properties
file or manually using the setters. When you use the setters, you need
to activate the options by calling the function activateOptions or
else you would get the "ERROR Message object not configured" message.
This is to ensure that the options would only become effective when
all the related options have been set (e.g. one would not want to have
the host setting become effective before the port is set).
FROM : https://community.oracle.com/thread/1758275?start=0&tstart=0
I'm trying to configure Logback (in Grails using Groovy configuration) so that:
any errors (from anywhere) are logged to a rolling file and send an email
all debug output from my classes is sent to the rolling file
This is what I have so far:
appender("ROLLING", RollingFileAppender) { ... }
appender("EMAIL", SMTPAppender) { ... }
logger("my.package", DEBUG, ["ROLLING"], false)
root(ERROR, ["ROLLING", "EMAIL"])
It seems that the rolling file gets what I expect (debug from my package at least) but the EMAIL appender gets nothing.
How can I send the errors to the EMAIL appender?
I am working in Grails application and want to log messages in different files. I want to log exceptions, normal and API logs in different files. But according to Log4j general roles, If we set logger level to 'Info' then warn and error messages will also start logging in this file while I want to log error messages in different file. So, thus my error messages will be logged twicely in error file and in info file too. While I want that 'info' logger log just 'info' level messages not 'error' level messages too. And 'error' logger just log error messages.
Below is my Log4j Configuration:
log4j = {
def layoutPattern = new PatternLayout("[%d{ISO8601}] %m \r\n")
def dailyRollingInfoFile = new DailyRollingFileAppender(
name:"rollingInfoFileAppender",
layout: layoutPattern,
//Path of the Log File
fileName:"C:\\MS-Logs\\Application\\MSLogs.log",
datePattern: "'.'dd-MM-yyyy")
def dailyRollingExceptionFile = new DailyRollingFileAppender(
name:"rollingExceptionFileAppender",
layout: layoutPattern,
//Path of the Log File
fileName:"C:\\MS-Logs\\Exceptions\\ExceptionLogs.log",
datePattern: "'.'dd-MM-yyyy")
def dailyRollingExceptionAPIFile = new DailyRollingFileAppender(
name:"rollingAPIFileAppender",
layout: layoutPattern,
//Path of the Log File
fileName:"C:\\MS-Logs\\API\\MS-NotificationsLogs.log",
datePattern: "'.'dd-MM-yyyy")
//For logging exceptions stack trace
appenders {
appender dailyRollingInfoFile
appender dailyRollingExceptionFile
appender dailyRollingExceptionAPIFile
}
root {
info 'rollingInfoFileAppender', additivity: false
debug 'rollingAPIFileAppender', additivity: false
error 'rollingExceptionFileAppender'
}
}
And Now, this is how I add filters:
dailyRollingExceptionFile.addFilter(new org.apache.log4j.varia.LevelMatchFilter(levelToMatch:'ERROR', acceptOnMatch: true))
dailyRollingExceptionFile.addFilter(new org.apache.log4j.varia.DenyAllFilter())
//To make it sure that It will just Log, Messages by Info Logger
dailyRollingInfoFile.addFilter(new org.apache.log4j.varia.LevelMatchFilter(levelToMatch:'INFO', acceptOnMatch: true))
dailyRollingInfoFile.addFilter(new org.apache.log4j.varia.DenyAllFilter())
//To make it sure that It will just Log, Messages by API Logger
dailyRollingAPIFile.addFilter(new org.apache.log4j.varia.LevelMatchFilter(levelToMatch:'DEBUG', acceptOnMatch: true))
dailyRollingAPIFile.addFilter(new org.apache.log4j.varia.DenyAllFilter())
How, It may be possible to avoid same message being logged twicely in different files ? How can we log messages in different files without being repeating it in other file ?
Thanks for your Time :)
I believe Log4j's LevelMatchFilter allows you to do what you're after:
def dailyRollingInfoFile = new DailyRollingFileAppender(...)
dailyRollingInfoFile.addFilter(new org.apache.log4j.varia.LevelMatchFilter(levelToMatch:'INFO', acceptOnMatch: true))
dailyRollingInfoFile.addFilter(new org.apache.log4j.varia.DenyAllFilter())
The DenyAllFilter drops the messages that the LevelMatchFilter does not match (ie. everything other than level INFO)
I'm trying to call a web service with a Java client. The WSDL looks like this: http://pastebin.com/m13124ba
My client:
public class Client{
public static void main(java.lang.String args[]){
try{
CompileAndExecuteServiceInterfaceStub stub =
new CompileAndExecuteServiceInterfaceStub
("http://192.168.1.3:8080/axis2/services/CompileAndExecuteServiceInterface");
Compile comp = new Compile();
comp.setArgs0("Test");
comp.setArgs1("public class Test { public static void main(String[] args) { System.out.println(\"Hello\");}}");
String[] classpath = {};
comp.setArgs2(classpath);
stub.compile(comp);
} catch(Exception e){
e.printStackTrace();
}
}
}
When I run the client now the following error occurs:
org.apache.axis2.AxisFault: unknown
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:517)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at de.dax.compileandexecuteclient.CompileAndExecuteServiceInterfaceStub.compile(CompileAndExecuteServiceInterfaceStub.java:184)
at de.dax.compileandexecuteclient.Client.main(Client.java:17)</blockquote>
I tried out the business logic of the server on my local machine and there it works. The service creates files and folders. Are web services allowed to do that? I also wrote a simple "Hello World" web service and deployed it to the server. This worked fine.
When you get one of these "unknown" AxisFaults, definitely check the server log! The client-side stack trace most likely will not be detailed enough for you to track down the error.
I believe dax is indicating above that he found the NullPointerException in the more-detailed server side stack trace. It would look something like:
org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
[....]
Caused by: java.lang.NullPointerException
[....]
From the provided logs, I cannot determine what's wrong. Try to set the log-level of Axis2 to "debug" (see the two log-configurations in the root directory of your Axis2 installation) and check the details for the exact cause. Axis2 tends to be a bit sparse in propagating the errors coming from webservices.
The problem was that there was an NullPointerException in my service.