siom79 / jdrivesync

jdrivesync is a simple command line tool that synchronizes a local file system structure to your Google Drive (and back)

Home Page:https://siom79.github.io/jdrivesync/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Writing log to the current directory is very non-UNIXy

proski opened this issue · comments

jdrivesync has no option to disable logging and it fails with a long stacktrace if run in a non-writable directory.

If jdrivesync is run by the user on the command line, it should log to the console only. If jdrivesync is run non-interactively, there should be a way to log its activity using syslog or a file specified on the command line. No respectable utility writes logs to the current directory by default. The directory may not be writable. The directory may be used for something else, and users don't expect logs to be written there. The log contents may be confidential and it could end up in a directory available to other users.

The worst case scenario - jdrivesync is run is a folder corresponding to a shared folder, while the whole google driver contents is synchronized (including "How to take over the world.doc" and the exquisite porn collection). In the next run, the log is uploaded and becomes visible to others.

On the develop branch I have committed a change set that per default does not create a log file. You can pass instead the path to the log file using the new option --log-file:

java -jar jdrivesync-0.2.5-SNAPSHOT-jar-with-dependencies.jar --up -l "/home/user/dir"  -r "/backup"  --log-file /tmp/jdrivesync.log

You can build this version with these commands:

git clone https://github.com/siom79/jdrivesync.git
cd jdrivesync
git checkout develop
mvn clean install

Let me know what you think.

Released with version 0.3.0.