My setup:
Red Hat with:
Weblogic installation which hosts my (java) application.
What I try to achieve:
See the output (an error) of my application
Why I this way and not easier (set proper logging on the application itself):
This is a production server of a big company, I am not allowed to do any changes to the running applications
In the application something goes wrong and I am tasked with fixing it.
I checked the weblogic logs but they dont capture all the output of the application, and thus it does not capture the error im searching for.
So is there a way I can sort of connect to stdout/stderr and see the output printed live? (other suggestions are also most welcome but if its possible this seems like the easiest way to go?)
Extra info:
I have checked and confirmed the application writes to console, so it should appear in stdout. (right?)
Unless I misunderstand your question, you want to tail the logs.
Navigate to the directory where your logs are stored and run
tail -f LOGNAME.log
This should print to your console live any additional log lines that are added.
Related
I've taken a job where years ago their webmaster setup an intranet using Tomcat on a linux server. The users can create something in the test environment and then click "make live" and the Linux/Tomcat moves the file to a Linux/live PHP web setup.
I'm clueless how they're moving the files. What would be a common tool to do this in Tomcat and Java?
I realize this is vague, but any help would be appreciated. Let me know what other info would be needed.
Also there is a duplicate MySQL database in both servers. I'm guessing the Tomcat setup is writing duplicate info to both databases, but I don't see how the files are getting moved.
This sounds like the website content is completely stored in the database and written over to the other server.
Theoretically you could also have a rsync shell script and call that from php to actually synchronize files over to the other server.
If the "Make Live" is on click and happens immediately its either a direct db access or some script based synchronization.
If it takes a while it could be a cron-job. Maybe you should just check this anway crontab -l will work.
There are several options, you actually open the *.php which the user can edit the content and see where the make live button brings you e.g. "Post Form to *.php" and than you check what that script is doing or you show us the package (what i would like to see but not suggest if you are working on a companies site).
Get back here with some more information, so i can expand the answer for you. Maybe you should also clarify why you are clueless, state what you have checked already, the info i would require is the actual site which has the make live button on it, it will lead to the next site or a script which will probably show what the site is doing.
I wrote a simple Java app which I have placed in the start up folder of my programs which makes the program starts when the computer starts up. what is the easiest way to make it open a command line or something which I can see the System.out.println results instead of just running in the background?
You should familiarize yourself with logging frameworks such as logback and log4j. Instead of using System.out.println you use some special API and the logging library redirects all messages to preconfigured appenders like console or file.
In your case you can configure your application to log on console while developing and switch to file when configuring an application to run from startup.
This won't really open a new command line window on startup, but instead it will store all messages to some predefined file on disk - which is actually even better.
You can use Log4j API for logging the details with the predefined outputs. It is far better then using SOP. Because it is light waighted and also very simple to configure the logs in the other files with the output format whichever you want to make.
http://logging.apache.org/log4j/1.2/ Go to this url where you can find log4j api available.
Hope this work for you
Enjoy !!!
I am building a Java EE application using NetBeans 7.1.1. I would prefer to view the output from the Glassfish server and Ant building process in a separate application. I've set up OtrosLogViewer to tail the glassfish server.log file as well as the applications log4j logs. But I haven't figured out how to tail the ant build log. Nonetheless, while these work I'm hoping for a more elegant solution. (FYI: tail is a linux command that watches a specified log file and updates the output when changed, somewhat like the event viewer in windows)
What I like about OrtosLogViewer is that it uses a pattern to place the information into a tabulated table. That simply makes it easier for me to view what's going on behind the scenes without getting overwhelmed with stack traces. For instance, it's easy for 70% of the log to be taken up with the stack trace. Essential IF I need it but otherwise it's in the way.
Some alternative solutions:
A way to modify the logging output for netbeans in a tabulated table.(A plug-in maybe)
A way to send all the output from netbeans into a specified log file(s), which I can then tail with the application of my choice.
Any other ideas that makes it easier to view application debugging information
Since Ant calls a variable number of other tools while executing your build script, you are never going to find a perfect pattern for the format of it's output - the best you can do is match output like
[javac] Compiling X files...
[echo] compilation done
with a format like [tool] message.
In other words, each component called in the Ant build script is likely to have different ideas of how to format the output.
I'm having some problems tracing the reason that I can't load a java(fx) applet.
The java plugin console for the browser has always been my sole source of information for problem solving. The reason it isn't much help at the moment is that the applet starts to load, downloading the jar files and outputting a percentage to the console along with the occasional statement to say it's on the next jar file. At some point in time (different percentages each time) the console just closes unexpectedly and the applet stops loading. I know this isn't much to go on but I was wondering if there was any way that the output from the console could be stored to a file on the local machine. To debug this particular problem, changing security permissions temporarily would be acceptable.
The problem has occured on every pc i've tried, however if I keep refreshing after failure it seems to cache the jar files previously downloaded and thus get further through the loading process until it eventually works. My issue now is that on a particular customers network refreshing does not resolve the issue. I thought it may be a permissions issue writing to disk but I've tried an administrator account and still no luck. I've also tried a variety of browsers. It might also be worth noting that they go through a proxy server - when the applet tries to load it asks for the credentials for logging on to the proxy which seems to authorise fine.
If anyone has a suggestion on what I could try it would be gratefully received.
Thanks,
James
Two points:
You should be able to get a stack trace through the applet console viewer (which runs in the system tray on PC's) and if you open that up it will show you your stack trace for debugging.
Can you reproduce this problem using the Java Applet Viewer tool? This will allow you to write unit tests, and debug much more easily.
I forget where it is, but somewhere in the java control panel (one of the options under the advanced tab I believe) there's an option to turn on logging. This will log all output to the java console to a file as well. I've used this when trying to debug issues similar to this.
There's some info here on where the files will appear:
http://download.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/tracing_logging.html
The problem ended up being some JS code that was making calls to the applet before the applet had initialised.
I found a bug in an application that completely freezes the JVM. The produced stacktrace would provide valuable information for the developers and I would like to retrieve it from the Java console. When the JVM crashes, the console is frozen and I cannot copy the contained text anymore.
Is there way to pipe the Java console directly to a file or some other means of accessing the console output of a Java application?
Update: I forgot to mention, without changing the code. I am a manual tester.
Update 2: This is under Windows XP and it's actually a web start application. Piping the output of javaws jnlp-url does not work (empty file).
Actually one can activate tracing in the Java Control Panel. This will pipe anything that ends up in the Java console in a tracing file.
The log files will end up in:
<user.home>/.java/deployment/log on Unix/Linux
<User Application Data Folder>\Sun\Java\Deployment\log on Windows
/~/Library/Caches/Java/log on OS X
(If you can modify the code) you can set the System.out field to a different value:
System.setOut(new PrintStream(new FileOutputStream(fileName)));
If you are running a script (invoking the program via java) from Unix you could do:
/path/to/script.sh >& path/to/output.log
In Mac 10.8.2 logs could be found at /Users/<userName>/Library/Application Support/Oracle/Java/Deployment/log/.
Before you have to enable logging from Java Control Panel. Option "Enable logging" is at tab "Advanced". Java Control Panel could be started from "System preferences".
A frozen console probably means a deadlock (it could also mean repeated throwing of an exception). You can get a stack dump using jstack. jps may make finding the process easier.
try this guide it works for me. it also guides you that how you can set "System.setOut(fileStream);", "System.setErr(fileStream);"