Log file for JNLP application - Need suggestion - java

I'm developing a Java Swing application and enabled them with Java web start feature.
Currently, i'm logging the events in a log file and saving them in jre folder.
Is this a correct way of doing?
If not where can i save the log files?
Note : i've asked the same question in other forum, but unable to get any suggestions.

Better option is to store the log files in System.getProperty("user.home").

Related

Display log file in browser with java script

Hi I'va the next doubt and I want to know if it's possible to implement. I have some wars deployed in a wildfly/jboss server. For some reason, that server doesn't log anything and the administrator of it seems that doesn't want to do his job. So I was wondering if there's a way to see the log of each war in a browser by a frontend design by me.
I think that I can add in each war a log file, but, there's possible to access each file from a browser and see each one? Also there's no need to be in real time.
Help would be appreciated.
Thanks.

Log4j to write alternate log file if working folder crashed

I have done log4j configuration properly and working fine to write logs from my application, i used log4j.XML in spring web application.
But the problem is if the current log file directory is crashed i need to write logs in some other directory to take logs during that time.
Give me any suggestion to meet above requirements.

Replace Applet in downloading and executing a file

I have an application that has an applet that does two simple things:
Download an executable jar file from our server (if the user doesn't already have it) to an specific folder in the user's PC
Execute the jar file with the corresponding parameters
This jar file monitors an Office file for changes and send it back to our server.
The problem is the war Chrome is creating with Java with this NPAPI thing. So I have until September to think of an alternate technology or stop the Chrome support.
Do you think of some other way to achieve the same result? Just download and execute. Doesn't seem that hard =(. Can HTML 5 do that?
EDIT
I was looking into Java Web Start and became a little happy. It appears that it can do what I want: executing a up to date jar file passing parameters. But I never worked with JWS, so I have some doubts:
Is it possible to pass parameters to it? I read about some JSP files that you can configure to do that, but I'm still unsure.
Theoretically, it should start automatically from a browser link, am I right? I tried this site:
https://docs.oracle.com/javase/tutorial/deployment/webstart/running.html
and it didn't work that way. I had to mark "always open files of that type" on Google Chrome. Is there a way for automatize it?
Thanks again!!
From what I know there are at least two things that allow you to stick with Java.
Webstart
Install4
Webstart is provided by Oracle and allows you to download Java program from the web and execute them. Update mechanisms exist, so you can always provide a current version.
Install4J (or any other installer for Java applications that offers an update mechanism) provides an installer which enables your customer to install an application which afterwards will be kept up to date by the integrated update mechanism. But Install4J comes at a price, there might be freeware / open source alternatives. Install4J and its alternatives are often discussed here on SO, you might want to check here.
I think the FileAPI of HTML5 is limited and can not access arbitrary files because a sandbox prevents this. You might check SO again for details about that.

Manage error log in Java

I have an issues with the file Error.log which is generate by Java.
It's too big (Currently >10Go) I can't open it with Notepad++/SublimeText etc.. and as it's on a dedicated computer, transfering it with Teamviewers make Teamviewer crash.
I would like to know if there is a way to configure how the error.log file is generated.
I want to have one file each days and only keep the last 7 days.
Can I configure Java to do that ? Or do I need to redirect System.err to a file ?
Thanks.
There are some java libraries you can use to manage log files the most popular log4j. So if you can edit the source code, this library can help achieve what you want. Besides that there are some tools that can handle large log files and give you search functionnality, edit reports and so on. try look for splunk, elasticsearch, kibana ..
If you have source code available just change log4j configuration. If not then try following
create a job which checks consistently to the log file and rename this when size exceeds some configurable value.

Under LINUX where should application initialization and support files be placed?

I'm coding a Java application which when operational will start when the headless computer boots to control and save data from digital cameras. The app requires some initialization files, other support files, and a folder for logs which I have put in /usr/local/data. The folder "data" is read/write for everyone. A remote user will need to access initialization files from time to time.
Is this a good place for this? Does LINUX use a standard place for application files and folders?
There are a few standards to pick from.
IMHO, creating a user to run the process with configuration and data under its home directory is the best way to keep everything in one place (thats easy to find)
There is the Linux standard base which defines these LSB conventions.
Logs: /var/log/.log or /var/logs/.d/ for logs. Example: /var/log/samba.log or /var/log/samba.d/error.log
Configuration files: /etc/ or /etc/.d/
Data you want while running, but not for initial configuration: /var/cache/
Check File System hierarchy standard
http://www.pathname.com/fhs/
usually, application data stored in /var/lib/ , logs in /var/log/, /etc/ for config and so on.

Categories

Resources