Skip to content

Commit

Permalink
Change to rolling logs (#11023)
Browse files Browse the repository at this point in the history
* Change to rolling logs

Co-authored-by: Carl Christian Snethlage <[email protected]>

* Add link to PR

---------

Co-authored-by: Carl Christian Snethlage <[email protected]>
  • Loading branch information
koppor and calixtus authored Mar 13, 2024
1 parent 45035df commit ff1195d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We changed the duplicate handling in the Import entries dialog. Potential duplicate entries are marked with an icon and importing will now trigger the merge dialog [#10914](https://github.com/JabRef/jabref/pull/10914)
- We made the command "Push to TexShop" more robust to allow cite commands with a character before the first slash. [forum#2699](https://discourse.jabref.org/t/push-to-texshop-mac/2699/17?u=siedlerchr)
- We only show the notification "Saving library..." if the library contains more than 2000 entries. [#9803](https://github.com/JabRef/jabref/issues/9803)
- JabRef now keeps previous log files upon start. [#11023](https://github.com/JabRef/jabref/pull/11023)
- We enhanced the dialog for adding new fields in the content selector with a selection box containing a list of standard fields. [#10912](https://github.com/JabRef/jabref/pull/10912)
- We store the citation relations in an LRU cache to avoid bloating the memory and out-of-memory exceptions. [#10958](https://github.com/JabRef/jabref/issues/10958)
- Keywords filed are now displayed as tags. [#10910](https://github.com/JabRef/jabref/pull/10910)
Expand Down
18 changes: 8 additions & 10 deletions src/main/java/org/jabref/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
import java.util.List;
import java.util.Map;

import org.jabref.architecture.AllowedToUseStandardStreams;
import org.jabref.cli.ArgumentProcessor;
import org.jabref.cli.JabRefCLI;
import org.jabref.gui.Globals;
import org.jabref.gui.JabRefGUI;
import org.jabref.logic.UiCommand;
import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.journals.predatory.PredatoryJournalListLoader;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.net.ProxyAuthenticator;
import org.jabref.logic.net.ProxyPreferences;
import org.jabref.logic.net.ProxyRegisterer;
Expand Down Expand Up @@ -48,7 +46,6 @@
* - Handle the command line arguments
* - Start the JavaFX application (if not in cli mode)
*/
@AllowedToUseStandardStreams("Direct output to the user")
public class Launcher {
private static Logger LOGGER;
private static boolean isDebugEnabled;
Expand Down Expand Up @@ -140,11 +137,13 @@ private static void addLogToDisk() {
// The "Shared File Writer" is explained at
// https://tinylog.org/v2/configuration/#shared-file-writer
Map<String, String> configuration = Map.of(
"writerFile", "shared file",
"writerFile.level", isDebugEnabled ? "debug" : "info",
"level", isDebugEnabled ? "debug" : "info",
"writerFile.file", directory.resolve("log.txt").toString(),
"writerFile.charset", "UTF-8");
"writerFile", "rolling file",
"writerFile.level", isDebugEnabled ? "debug" : "info",
"writerFile.file", directory.resolve("log_{date:yyyy-MM-dd_HH-mm-ss}.txt").toString(),
"writerFile.charset", "UTF-8",
"writerFile.policies", "startup",
"writerFile.backups", "30");

configuration.forEach(Configuration::set);
initializeLogger();
Expand All @@ -169,9 +168,8 @@ private static boolean handleMultipleAppInstances(String[] args, RemotePreferenc
LOGGER.debug("Passing arguments passed on to running JabRef...");
if (remoteClient.sendCommandLineArguments(args)) {
// So we assume it's all taken care of, and quit.
LOGGER.debug("Arguments passed on to running JabRef instance.");
// Used for script-use output etc. to the user
System.out.println(Localization.lang("Arguments passed on to running JabRef instance. Shutting down."));
// Output to both to the log and the screen. Therefore, we do not have an additional System.out.println.
LOGGER.info("Arguments passed on to running JabRef instance. Shutting down.");
return false;
} else {
LOGGER.warn("Could not communicate with other running JabRef instance.");
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ Application\ to\ push\ entries\ to=Application to push entries to

Apply=Apply

Arguments\ passed\ on\ to\ running\ JabRef\ instance.\ Shutting\ down.=Arguments passed on to running JabRef instance. Shutting down.

Assign\ the\ original\ group's\ entries\ to\ this\ group?=Assign the original group's entries to this group?

Assigned\ %0\ entries\ to\ group\ "%1".=Assigned %0 entries to group "%1".
Expand Down

0 comments on commit ff1195d

Please sign in to comment.