How do I turn off this logging? - java

How do I turn off this logging?
Log
Dec 03, 2013 1:23:21 PM com.google.appengine.datanucleus.MetaDataValidator validate
INFO: Performing appengine-specific metadata validation for com.mwv.pic.dto.Study
lib/logging.properties
.level=INFO
# Set the default logging level for ORM, specifically, to WARNING
DataNucleus.level=WARNING
com.google.appengine.datanucleus=WARNING
Run Configurations > Arguments > Program Arguments
-Djava.util.logging.config.file=file:lib/logging.properties
If I put -Djava.util.logging.config.file=file:lib/logging.properties in VM argument properties, then NOTHING will log!

I think that you will find that DataNucleus JDO (if indeed you are using JDO) depends on the logging technology Apache Log4J.
I use JDO and define DataNucleus Log4J settings in files called "log4j.properties": one for production and one for app building using NetBeans.

Related

Tomcat 8.5 - Cache warning flood

I am trying to migrate from Tomcat 8.0.37 to 8.5.6
In this new version, the err console is flooded constantly with these warnings:
oct. 27, 2016 3:16:40 PM org.apache.catalina.webresources.Cache getResource
WARNING: Unable to add the resource at [/WEB-INF/lib/something.jar]
to the cache because there was insufficient free space available after evicting expired cache entries -
consider increasing the maximum size of the cache
I want to configure the servlet (web.xml or Spring) to ignore caching for some file types (*.jar)
I've read about configuring the context.xml file but it feels like a workaround the real issue.
how can I tell Tomcat to log everything to slf4j?
I added this to the manifest but it doesn't work :
Dependencies: org.slf4j
The cache warnings are caused by a known bug in 8.5.6 that will be fixed in 8.5.7. The new version should be available in a week or so.
If you want to use slf4j then following the slf4j instructions for redirecting java.util.logging output.

Running Project on Tomcat Through Eclipse

I have a project file that I am trying to run through eclipse on tomcat. Right now the server starts up, but when I try to access the server (with localhost:8080), I get a 404 error. Looking at the server console found in Eclipse, I am seeing some weird messages and was hoping that one of you could make sense of them. The messages are below. Thanks!
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;;.
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ROOT' did not find a matching property.
INFO: JSR 356 WebSocket (Java WebSocket 1.0) support is not available when running on Java 6. To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocket JARs to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in $CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 WebSocket API will be available.
Looks like your Tomcat starts properly.
The messages you get:
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path
This just means you don't have a native library which would make Tomcat run even faster. No worries.
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ROOT' did not find a matching property.
This means that in the server.xml file of your Tomcat the <Context> element contains a source attribute and Tomcat can't/won't handle it so it will be ignored.
INFO: JSR 356 WebSocket (Java WebSocket 1.0) support is not available when running on Java 6.
This just means WebSocket is not available/not supported under Tomcat 6. No worries.

Removing the Logs in Java

I want To remove the logs which gets generated during runtime of code.
E.g i m using asterisk-java for voip/asterisk and I always got following messages
Jul 30, 2012 10:55:17 AM org.asteriskjava.manager.internal.ManagerConnectionImpl connect
INFO: Connecting to 192.168.0.27:5038
Jul 30, 2012 10:55:18 AM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier
INFO: Connected via Asterisk Call Manager/1.1
Jul 30, 2012 10:55:18 AM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier
WARNING: Unsupported protocol version 'Asterisk Call Manager/1.1'. Use at your own risk.
Jul 30, 2012 10:55:18 AM org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin
INFO: Successfully logged in
Jul 30, 2012 10:55:22 AM org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin
INFO: Determined Asterisk version: Asterisk 1.0
Is there any configuration setting or other way around to remove the log and prevent it from generating while runtime of my code executions.
Thanks
By default Asterisk-Java uses java.util logging so you can have a look at the JDK documentation on how to configure it.
This link might help you.
How do I disable the debug or "INFO" output from asterisk-java?
Can't you simply change the log level by name/package?
Logger.getLogger(org.asteriskjava.manager.internal.ManagerConnectionImpl.class).setLevel(Level.OFF);
You did not tell if you are using log4j or jdk logging
Googling on how to disable logs in asterisk-java gave this
http://www.asterisk-java.org/development/faq.html
Are you using something like log4j???
im not sure what your requirement is.
but if you dont want to see any logs at runtime then write all you logs at INFO or DEBUG level
then change the logLevel to ERROR or FATAL in log4jProperties.
but just understand that the purpose of logs is to see them during run time.
If you simply want to suppress output from the application, you could do
System.setOut(new PrintStream("stdout.log"));
System.setErr(new PrintStream("stderr.log"));
(Or create your own PrintStream subclass which just suppresses all output.)
This has been solved with help of mr srikanth yaradla.
I was needed to do the changes in the logging.properties file.which was not done by me earlier.

Is there a way to silence hsqldb logging?

I have an embedded Hsqldb set up in my project. But it dumps a lot of info on the output when working, and I currently do not need that info:
Mar 29, 2012 10:18:11 PM org.hsqldb.persist.Logger logInfoEvent
INFO: Checkpoint start
Mar 29, 2012 10:18:11 PM org.hsqldb.persist.Logger logInfoEvent
INFO: checkpointClose start
Mar 29, 2012 10:18:11 PM org.hsqldb.persist.Logger logInfoEvent
INFO: checkpointClose end
Mar 29, 2012 10:18:11 PM org.hsqldb.persist.Logger logInfoEvent
INFO: Checkpoint end
Is there a way to silence that output?
Unfortunately, i don't believe so. we have the same issue in our project. i believe i checked the source at one point in time and concluded that hsqldb does not provide a way to influence this logging.
I stand corrected (as #fredt mentioned in his comment to the other answer), you can control this logging via the jdk log levels. setting the "hsqldb.db" log level to something like WARNING will suppress this output. you can do this using the logging.properties file or programmatically (after hsqldb loads) using something like Logger.getLogger("hsqldb.db").setLevel(Level.WARNING) (assuming you are using java util logging).
As noted in the comment below, hsqldb also resets the java logging configuration. If embedding it in another application, you may want to disable that functionality by setting the system property "hsqldb.reconfig_logging" to "false" (before hsqldb is loaded).
For anyone looking for a command line solution.
Start your app/server with a property pointing to the location of a dedicated properties file:
-Djava.util.logging.config.file=/location/of/your/hsqldblog.properties"
Which contains the following line to change Java logging for Hsqldb.
# Change hsqldb logging level
org.hsqldb.persist = WARNING
Side note, you can choose from the following levels:
SEVERE WARNING INFO CONFIG FINE FINER FINEST
More info on Java Logging
For Slf4j + Logback users:
Add log4j-over-slf4j as a dependency (don't forget to exclude original log4j dependency if you have any). If you use Gradle, add something like this into your build.gradle:
runtime group: 'org.slf4j', name: 'log4j-over-slf4j', version: '1.7.25'
Then, add this to your logback.xml:
<logger name="hsqldb.db" level="warn"/>
You can use setSilent(true) when starting server from code:
Server server = new Server();
server.setSilent(true);
server.setDatabaseName(0, "mainDb");
server.setDatabasePath(0, "mem:mainDb");
server.setPort(9001);
server.start();

google app engine service unavailable

I'm was following http://googcloudlabs.appspot.com/ tutorial to create new Google App Engine project. It throws me an error as per below when I try to run the from my local host, but when I deployed it working fine. (http://mynewcloudcom.appspot.com/). Please help.
HTTP ERROR: 503
Problem accessing /. Reason:
SERVICE_UNAVAILABLE
Powered by Jetty://
Eclipse Console
Mar 05, 2012 10:42:46 AM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Mar 05, 2012 10:42:46 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed C:\Smartag_Eclipse_Project\DontEditProject\war\WEB-INF/appengine-web.xml
Mar 05, 2012 10:42:46 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\Smartag_Eclipse_Project\DontEditProject\war\WEB-INF/web.xml
Mar 05, 2012 6:42:48 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:8888/
Mar 05, 2012 6:42:48 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at http://localhost:8888/_ah/admin
Found the answer. I need to run in JDK1.6. Once i changed the Java Compiler(right click project -> properties -> Java Compiler -> (Check) Enable project specific settings -> change the Compiler compliance level), its works fine now. Thanks.
I had the same problem. I justed changed the port from 8888 to 80 in the Debug Configuration and it worked for me.
I had the same issue.
for me the problem was one of my filters had an exception. specifically objectify - it was not loaded properly. you can delete the filter and see if that's it
When using Java 1.7, also check for the Execution Environment and set it to JavaSE-1.7.
You can look into the Execution Environment in:
Right Click -> Properties -> Java Compiler
And you have the option above Restore Defaults and Apply.
I faced the same issue and resolved it by selecting "Automatically select an unused port" in run configuration.
Sometimes it happens there is a "hanging" process that blocks the port. Therefore changing port in Run configuration helps, as well as checking "Automatically select an unused port" in run configuration.
It happened with me too. In my case, I had Run the project and due to some error in my code, the Project ran with errors. So, I debugged it and Run it again but without cancelling the earlier one in the console and it gave me that error. After cancelling or stopping the Project, it ran fine.
i had the same issue. Seems that Plugin is stocked on creating and opening the socket for the server. i don't really know why happens, I've resolved in this way.
Open Run Configurations.
Open Server tab. Change the Embedded server Port.
Open Arguments tab.
3.1 - VM arguments box. i've deleted all that stuff there and just let this
line and save changes and run it.
-Xmx512m -javaagent:/Applications/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.7.5/appengine-java-sdk-1.7.5/lib/agent/appengine-agent.jar
It has worked pretty good 4me.
If someone know which events or configuration change are the reason for . please let us know it
NOTE: "I'm not responsible for unexpected behave. I'm don't know if there is side effects ahead"
The solution working for me is to run appEngineServer from command line using Gradle, as comments in generated build.xml for endpoints module proposes. And gradle config includes option for Java 1.7 compatibility, so it's no reason to use Java 1.6 if You want 1.7:
gradlew modulename:appengineRun
Currently, the appengine gradle plugin's appengine devappserver
launch doesn't interact well with Intellij/AndroidStudio's
Gradle integration. As a temporary solution, please launch from the command
line. ./gradlew modulename:appengineRun
I had a condition where a servlet defined in the web.xml with non existent class name. I specified proper class name, worked!

Categories