print command doesn't work

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

print command doesn't work

#1

Postby Segi » Thu Mar 29, 2018 8:44 pm

While debugging a problem today on my production server (Verj 5.3.2) , I noticed that when I issue the print command, it doesn't print to the server log.

Here's my log4j.xml: https://pastebin.com/sKvyimRQ

I compared this log4j with one from another instance of Verj where printing DOES work correctly and both files are identical (I used the file compare feature of my text editor which says that both files are completely identical).

I restarted my server as well but that didn't make a difference.

Update: I don't know what happened but it suddenly started working again
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

Re: print command doesn't work

#2

Postby Jon » Tue Apr 03, 2018 8:08 am

The print command writes directly to System.out and this is handled differently by tomcat depending on the operating system. Under Linux or running as a Windows service, the output should appear in a catalina.out log file. Running under Windows using the bat file, the output should appear in the console window.Here's a quote from the tomcat documentation:
When running Tomcat on unixes, the console output is usually redirected to the file named catalina.out. The name is configurable using an environment variable. (See the startup scripts). Whatever is written to System.err/out will be caught into that file. That may include:

Uncaught exceptions printed by java.lang.ThreadGroup.uncaughtException(..)
Thread dumps, if you requested them via a system signal
When running as a service on Windows, the console output is also caught and redirected, but the file names are different.

The default logging configuration in Apache Tomcat writes the same messages to the console and to a log file. This is great when using Tomcat for development, but usually is not needed in production.

Old applications that still use System.out or System.err can be tricked by setting swallowOutput attribute on a Context. If the attribute is set to true, the calls to System.out/err during request processing will be intercepted, and their output will be fed to the logging subsystem using the javax.servlet.ServletContext.log(...) calls.
Note, that the swallowOutput feature is actually a trick, and it has its limitations. It works only with direct calls to System.out/err, and only during request processing cycle. It may not work in other threads that might be created by the application. It cannot be used to intercept logging frameworks that themselves write to the system streams, as those start early and may obtain a direct reference to the streams before the redirection takes place.
0 x


Who is online

Users browsing this forum: No registered users and 5 guests