1

I created Java application (GUI) running on Windows that interacts over SSH with SQL DB configured on one Unix server, in my application i have several "print" messages as debug info to help analyzing program functionality in case of problems (ex. track user activity, track changes applied on the DB ...etc.), i need to create a log file to be stored on that Unix server to log all debug information and any encountered error message.

The log file should have following specs:

  • Naming: log_(last time file was modified).log
  • location: stored under /var/tmp
  • Size: Maximum size is 10 MB after which new file is created, old file is renamed to .log.old
  • file closed with app exit, same file re-opened with app start if size is still < 10 MB otherwise new file to be created/opened.

Any ideas? please help

Thanks in advance.

A.Midany
  • 201
  • 1
  • 5
  • 16

2 Answers2

1

Chose one of the available log frameworks which have out of the box support for the features that you requested: http://en.wikipedia.org/wiki/Java_logging_framework

However this will ensure that you have a log on the machine where you are running the application, so according to your description that would be your windows box. To create a log on the *nix server I guess you could split your application in 2 parts:

  • the GUI running on windows which sends commands to the controller
  • the "back-end controller" running on *nix, acting as a bridge between the DB and your GUI. It receives commands from the GUI, queries the DB and logs the actions

EDIT:

Looks like the splitting of the app could be bypassed in a similar approach but with a little help from log4j:

Community
  • 1
  • 1
Morfic
  • 15,178
  • 3
  • 51
  • 61
0

If you have login details for the remote server then you can configure log4j to write to a remote syslog file there. See http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SyslogAppender.html

tom
  • 2,704
  • 16
  • 28
  • 1
    @user2459413 If you find an answer to be useful, you can "thank" the poster by clicking on the "Up arrow" on the left side. This will also help others with similar problems to identify worthy information – Morfic Nov 08 '13 at 12:57
  • @Grove, surely i would have done that but Vote-up needs 15 reputations which i don't have for the moment as i'm somehow a new user – A.Midany Nov 11 '13 at 23:04