I am using Cloudbees as my PAAS provider and wish to see the access logs as can be viewed in Tomcat. In my apps section I see a tab showing Application Logs and a tab for Access logs which shows nothing.
Is there a way I can turn on these logs?
This was a configuration problem, and has been fixed now
Related
I deployed a sample Java app like container on Heroku. I made heroku container:push <name> and heroku container:release <name> afterwards. Commands worked but I don't understand if the app itself is running since it should fire few times per day.
I tried to see general logs, got nothing. Where can I find container-related logs in Heroku?
UPDATE:
My logs are the following:
2019-12-18T21:21:20.002711+00:00 app[api]: Release v4 created by user
2019-12-18T21:21:20.002711+00:00 app[api]: Deployed worker
(c77c435c1355) by user
After this, no logs appeared.
If you use a logging framework (log4j, java Logging) you still need to initialise it to log to the stdout (Console), you should then be able to see your logs in the Heroku "View Logs" (or indeed with CLI heroku logs).
Are you using log4j? Add log4j.properties in the classpath of your apps.
You can also try the System.out.println to log into the stdout.
Hope it helps.
Beppe
As #Beppe C's answer mentions, I can use log4j or similar logging solutions.
There are a couple of possibilities for logging.
Use plugins in Heroku such as Papertrail that will scrape logs from Docker and post them into themselves. You can see, filter, search, and archive logs there.
Use external systems such as Sentry, AWS Cloudwatch, you name it. You will need to set up appenders and config to where to send logs. They will be sent from application. You will see only application-specific logs, not Heroku specific as in the 1st solution.
You have two main options, and sometimes it's just a good idea to use them both.
For security reasons, I wanted to remove docs and examples application. So, at first, I deleted both of them from the webapps directory. However, the remaining applications were not responding in browser, although the tomcat service is running in the server. I got blank screens.
Then I put back docs and examples in webapps directory, and things were back again. Then, I tried to undeploy them using tomcat manager. The undeployment works, but again I got blank screens.
I even tried restricting access to apps using valve and filters. And unfortunately, again I get blank screens.
Permission is not an issue, all contents belong to the tomcat user.
I am using Tomcat 8.5.37.
Update: I started with a clean installation. However, I get same result after undeploying docs and examples.
Update: I think it should be mentioned that we are using aws environment, and there is a load balancer. Also, in front of Tomcat we are using Apache (ajp_proxy).
There is Spring Boot application that runs on the server without exposing to external world. I connected Sentry to monitor it but never got any errors, even I have tons of them in the logs.
By without exposing to external world I mean that there is no open url that everyone can use for API connection.
How should I configure Sentry in order to get errors? Should I fall down to other scenarios, not default Spring Boot app configuration?
Sentry doesn't need to connect to your application. When you add Sentry's SDK to your app and configure it with the correct DSN, your app will connect to Sentry to send errors as they occur.
For that you need to make sure the DSN you used goes to the project your expect to see the events in Sentry. That could be a reason why you don't see the events.
Perhaps your server has not access to the Internet? Or if it does, it requires use of an internal proxy server which was not configured in your server/application/sdk.
I fight with this problem for some time but it seems that either some of error messages were lost on the way or Sentry.io default configuration for Spring Boot sends messages with low threshold, so 1 error message for several actual errors.
In the end, it fixed itself.
I have made my GAE application using the development server, but now when I deploy it to GAE cloud, some features don't work (some elements are missing), but no exceptions are thrown.
Now I'd like to have some logging to my code so I could find out why these things are working in development environment, but not in GAE cloud, but I haven't found a way to log events like I can do with the development server in Eclipse.
So is it possible to log events like you can do in the Eclipse development server?
Google App Engine applications written in Java can write information to the log files using java.util.logging.Logger. Log data for an application can be viewed and analyzed using the Administration Console, or downloaded using appcfg.sh request_logs.
More info in the Logging documentation.
You will have to configure logging via java.util.logging.Logger and a logging.properties file in your classpath, preferably in your WEB-INF/classes/ directory. e.g. if you want all your logging to be at the INFO level, the contents of this file should be:
# Set the default logging level for all loggers to INFO
.level = INFO
The article that was marked as correct answer is a little bit outdated.
Today if you have to read your logs or want remotely debug your app you can use
Google Stackdriver Logging (web)
Google Stackdriver Error Reporting (web)
Google Stackdriver Debug (web)
gcloud command-line interface to Google Cloud (console, just type gcloud app logs tail to see latests log from your deployed app)
Java GAE applications still write information to the log files using java.util.logging.Logger.
Again, if you want more information about the Google App Engine Java logging read the documentation.
I assume you are asking for the Log console to see the error info and such. if yes then open your Google app engine launcher and click on your app and you can see a Logs button on the top next to Run and Stop.
Good luck!
I am in the process of moving my web website over to google app engine and am having a problem with my site when it is deployed. The application was being hosted on tomcat/mysql and predominately consists of jsp pages. I have read the fallowing google documentation:
http://code.google.com/appengine/docs/java/config/webxml.html
I am unable to get any of the jsp pages to work correctly I keep getting a 500 Server Error
Error: Server Error
The server encountered an error and could not complete your request.
The project works great in the google app engine development environment but doesn't work when deployed it seems like the project isn't getting mapped.
Does anyone have any insight.
When your app raises an uncaught exception, App Engine shows the generic 500 page. In order to see the exception, you need to check the logs for your app in your app's admin console.
So after plenty of research I found the problem to be that some classes that are persisted need to also implement Serializable when you use sessions. For some reason I didn't see this in the documentation or come across it in my initial research.
I guess you have already done this, but you should be able to check if everything is fine locally, by first deploying locally using the app engine development server. http://code.google.com/appengine/docs/java/tools/devserver.html
If you're testing locally on tomcat + mysql, then you can't deploy on the app engine. The Google App Engine not does support SQL databases. Besides that, if you want a more detailed response you need to look at the app engine logs and tell us why it is throwing a 500 at you.