How to setup google app engine eclipse plugin logging level? - google-app-engine

I'd like eclipse to output debug level traces for my app and warning level traces for everything else.
Does not matter what I do in my WEB-INF/logging.properties, the only way to control logging level is through "Run" > "Debug Configurations...", select my app, then click on "GWT" tab and change logging level. The problem is that it sets debugging level for all loggers.
Is there a way to make it output debugging messages only for my app?
Here is how my WEB-INF/logging.properties looks like:
java.util.logging.ConsoleHandler.formatter=myproject.LogFormatter
# Set the default logging level for all loggers to WARNING
.level=WARNING
#org.datanucleus.level=WARNING
#org.apache.level=WARNING
#com.google.apphosting.level=WARNING
myproject.level=FINEST
# Set the default logging level for ORM, specifically, to WARNING
DataNucleus.JDO.level=WARNING
DataNucleus.Persistence.level=WARNING
DataNucleus.Cache.level=WARNING
DataNucleus.MetaData.level=WARNING
DataNucleus.General.level=WARNING
DataNucleus.Utility.level=WARNING
DataNucleus.Transaction.level=WARNING
DataNucleus.Datastore.level=WARNING
DataNucleus.ClassLoading.level=WARNING
DataNucleus.Plugin.level=WARNING
DataNucleus.ValueGeneration.level=WARNING
DataNucleus.Enhancer.level=WARNING
DataNucleus.SchemaTool.level=WARNING

It appears that Google broke logging somewhere around SDK 1.3.7 when they tried to combine the GWT and Appengine loggers. Here's the "Fixed" bug:
http://code.google.com/p/googleappengine/issues/detail?id=4011
Unfortunately they made the situation far worse - it appears there is no way to separate the GWT logging controls from the appengine logging controls, and the GWT logger ignores your logging.properties. The craziest part is that if you have a GAE app without GWT, you have no control over logging whatsoever - you can't set the threshold to DEBUG.
As far as I can tell, we're screwed until this issue gets resolved - and it hasn't even been Acknowledged yet:
http://code.google.com/p/googleappengine/issues/detail?id=4591
Please star that issue and throw tantrums on the appengine-java mailing list :-(

Related

How can I disable logging of Google App Engine Health Checks: /_ah/vm_health

I created a DotNet Core App
Deployed it on the Google App Engine (Custom / Flex)
I opened the logging tab
I noticed the following entry: _ah/vm_health
It is not there once or twice, it is there very large number of times
Questions:
How can I exclude this one from the logs, I know the system is checking if everything is healthy, and this is good, I just don’t want it logged.
How can I exclude anything from the logs? For example, there is an entry, and it is sending things to the logs, and wanted ignored by the log system.
You can't disable logging of the health checks: they're still requests hitting your app and they're logged like any other request.
In the StackDriver Logs Viewer you might be able to use the Advanced Logs Filters to filter out and prevent displaying of the undesired logs. I can't give an actual example, though, as I didn't yet use this facility. Just to be clear - this just prevents displaying the logs when the filter is applied, the logs are not ignored by the logging system.

Jenkins IRC plugin - how to disable logging?

I'm using Jenkins 1.651 with the IRC Plugin 2.27 and
instant-messaging plugin 1.35.
I've noticed that the IRC plugin logs a lot of INFO level messages to the Jenkins log (GUI and on-disk). I'd like to configure logging for this plugin, or disable logging for the plugin entirely.
I've tried adding a new log recorder for the logger hudson.plugins.ircbot, but the plugin still logged to the general Jenkins log. Any pointers?
I found this tweet:
https://twitter.com/russss/status/806560486166822915
(You can fix by changing the level of org.pircbotx.InputParser to WARNING at /log/levels in the web interface. Thanks, pircbot...)
I can confirm this works, but the config doesn't seem to stick after you restart Jenkins. If anyone knows where to capture this to make it permanent, that would be great!
Edit: so not ideal, in so far as it knocks all Jenkins logging back to the level of WARNING or higher (no more INFO messages) but this is a permanent fix to the problem you can capture in code and config:
Add the following to JAVA_ARGS for Jenkins (we typically do this in /etc/default/jenkins) :
-Djava.util.logging.config.file=/var/lib/jenkins/logging.properties
Then create the file /var/lib/jenkins/logging.properties, containing the following:
handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
.level= WARNING
No more IRC messages in the Jenkins log!
This answer actually provided by my colleague, mig5
There is a bug https://issues.jenkins-ci.org/browse/JENKINS-46099 that asks for addressing this issue in a persistent way.

How can I view Log statements in Google Developers Console for a deployed GAE project?

I know that when you run a Google App Engine project locally you can view Log statements in your API methods:
log.warning("Some warning because you did something");
But can you view those logs for a deployed project? When I go to Logging in the google developers console I can see logs for various actions of my API but I cannot see my custom logs I put into my methods like the one above.
I am using Java.
There are multiple ways you can achieve this. Though I suggest using one of these two:
Use google's logging library which will write logs for you and they will be available in log viewer and you can export them to your cloud storage or use them as pub/sub events. https://cloud.google.com/logging/docs/api/libraries
If you just want your logs to be visible in the log viewer, another alternative is to use a logging library which writes the logs to syslog (http://www.networkmanagementsoftware.com/what-is-syslog/) and use google-fluentd on your instance. This will collect your custom logs as well as any other event logs to the log viewer.
I had to go into logging.properties in my project and change:
# Set the default logging level for all loggers to WARNING
.level = WARNING
to
# Set the default logging level for all loggers to WARNING
.level = INFO
Now it works. Not sure why though.

Java Google AppEngine Managed VMs: What logs are obtainable through the Logging API?

I like that I can use the Logs API (described here: https://cloud.google.com/appengine/docs/java/logs/) to programatically access and display app & request logs as I see fit--it's great.
Now that I'm using Managed VMs on AppEngine you can see on the Admin Console Logs Viewer that there are a ton of additional logs--including in my case a custom log which I found I could include in the viewer (decribed here: https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes#logging).
My question is: Is there any way I can use the Logs API (or other pipelines already built?) to access these logs? My Managed VM module includes several components which could produce logs that I want to view:
App logs -- I can get these! No problem here.
Custom log files created by background processes I kick off in _ah/start (like "my_custom_1.log" in the screenshot)
STDERR & STDOUT from my background processes
Relevant Managed VM logs (e.g. for when an instance was restarted due to bad health... other system events like normal restarts?)
Basically I want "the total picture" at the instance level. Anyone tried to tame Managed VMs in this way with success? I'm not looking forward to rolling my own solution. And I wouldn't even know where to start on the problem of capturing STDERR and STDOUT. Any help appreciated.
There is a difference between App Engine logging and Google Cloud logging. Some of the Managed VM logs go to both, but much of it only goes to cloud logging.
Until recently there was not an API to read Cloud logs, only to write them. However, there is a new v2 beta API: https://cloud.google.com/logging/docs/api/introduction_v2
To do things at an instance level, entries in Cloud logging should have metadata set to denote which VM they came from. Both of these values seem to vary on logs from my VMs:
compute.googleapis.com/resource_name
compute.googleapis.com/resource_id

Google App Engine + Jersey + IntelliJ Idea

Okay so I'm having some annoying issue here. I am clearly missing something, and already been frustrating myself with this for the last 4-5 hours.
I cannot seem to be able to create a simple GAE+Jersey up and running with IntelliJ.
The frustrating part is that I do not get any errors, just that the REST service is not present after deployment.
I've tried out a few basic stuff, basically everything you can find on Google (and here).
After some frustration I've downloaded this project: https://github.com/BluerockInteractive/GAE-Jersey-Guice-Sample
Just cause this will list out the available servers, plus the deeper logging level.
Now here's the output of the AppEngine startup:
https://docs.google.com/open?id=0B42XvjSlpDCtTTdwQl9MSTBlQ0U
So my problem: The AppEngine is up and running. If I create a basic servlet everyting works fine. However, I cannot get Jersey to work. In every form I could try it always throws an
HTTP ERROR 404
Problem accessing /jerseyguicesample. Reason:
NOT_FOUND
Powered by Jetty://
Any ideas, what I could be missing here?
Here's an image of the IDE and the artifact settings: http://img51.imageshack.us/img51/7913/20120428124133.png
Thanks, :D
This example has REST handlers mapped to /rest/test, /rest/players/{name}/xml, /rest/players/{name}/json and /rest/hello.
What (and where) did you map /jerseyguicesample to?

Resources