3

I started my web application using

java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port 9000 *.war

Is there any way to see logs now?

My console output:

sergei_rudenkov@EPAm18851:~/IdeaProjects/fsdf$ java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port 9000 web-archive-test.war
Adding Context  for web-archive-test.war
Feb 05, 2016 2:18:33 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-9000"]
Feb 05, 2016 2:18:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Feb 05, 2016 2:18:33 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Feb 05, 2016 2:18:33 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.24
Feb 05, 2016 2:18:33 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Feb 05, 2016 2:18:33 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Feb 05, 2016 2:18:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-9000"]

My browser:

browser

I has logging.file=mylog.log in application.properties but it doesn't write anything. I created war file using this command jar cvf web-archive-test.war . What is interesting everything works fine when I launch it from Idea.

Community
  • 1
  • 1
Rudziankoŭ
  • 10,681
  • 20
  • 92
  • 192
  • You are only using Tomcat in an indirect way. Check how https://github.com/jsimone/webapp-runner does handle logging. Which logging framework do you use ? Did you change it from the default ? – Marged Feb 05 '16 at 10:50
  • No, I didn't change nothing, I have a peace of log in my console but it's only about that tomcat has started successfully. Could I see somewhere logging of http request - responses. Should I do it grammatically inside my app save them to file and then recompile war file? – Rudziankoŭ Feb 05 '16 at 10:55
  • Show us the code where you log information. Perhaps you are logging on a DEBUG level and your loglevel is set to INFO (when you won't see any output until you change the level on either side) – Marged Feb 05 '16 at 10:59
  • Couple of questions: *I have a peace of log in my console* how you print the information in console? Also... which version of tomcat and OS are you using? – Jordi Castilla Feb 05 '16 at 11:16
  • 1
    I am using Tomcat 8, Java 8, Spring Boot, and Ubuntu. To be correct I see only tomcat log, but I want to see my application log. My `application.properties` file looks like this: `logging.file=mylog.log` But it doesn't write anything during war execution it writes only when I launch it from IDE – Rudziankoŭ Feb 05 '16 at 11:22
  • post your logger config file, I think you're missing file appender declaration @Marged what you think? – Jordi Castilla Feb 05 '16 at 11:43
  • To diagnose this you should add the actuator to your project, it will show you which endpoints get mapped. Similar info might be shown by running your program with --debug, but the actuator looks more nice and reveals more. Add `logging.level.root=trace` to your `application.properties` and see if the log still is empty ;-) – Marged Feb 05 '16 at 11:55
  • What I don't understand is why do use this webapp-runner. Spring Boot has other means to create a selfcontained application. Why not use this ? (Because your screen is missing the characteristic output if Spring Boot I think you are not using it the "standard" way) – Marged Feb 05 '16 at 11:57
  • Yes, this is not 'standard' way, I want my app to be deployed on heroku, and it can be run only using web-runner. Thanks for suggestions I will try them all – Rudziankoŭ Feb 05 '16 at 12:15
  • I asked webapp-runner developers on github https://github.com/jsimone/webapp-runner/issues/59 – Rudziankoŭ Feb 05 '16 at 12:33
  • Please mention this from the beginning next time ! – Marged Feb 05 '16 at 13:02

1 Answers1

5

You implemented a logging system?

  • NO: go to C:\Program Files\Apache Software Foundation\Tomcat x.x\logs to find them
  • YES

    You provided a specific log folder in config?

    • YES search for this folder location in the server filesystem.
    • NO search for the default log folder of your logging system.
Jordi Castilla
  • 26,609
  • 8
  • 70
  • 109