Git Product home page Git Product logo

terminalconsoleappender's People

Contributors

a248 avatar ichttt avatar stephan-gh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terminalconsoleappender's Issues

Unable to run TerminalConsoleAppender under Cmder/ConEmu

Cmder is a great alternative to the command line on computers running versions older than Windows 10.

Cmder is a console emulator and uses ConEmu as it's base. This means the problems just need to be fixed with ConEmu and Cmder will work correctly.

I got this error whilst trying to run a Waterfall server.

Here's the full log:

[20:06:15 INFO]: Using standard Java JCE cipher.
[20:06:15 INFO]: Using standard Java compressor.
[20:06:15 INFO]: Enabled Waterfall version git:Waterfall-Bootstrap:1.13-SNAPSHOT:92eb8b4:209
[20:06:16 INFO]: Discovered module: ModuleSpec(name=cmd_alert, file=modules\cmd_alert.jar, provider=JenkinsModuleSource())
[20:06:16 INFO]: Discovered module: ModuleSpec(name=cmd_find, file=modules\cmd_find.jar, provider=JenkinsModuleSource())

[20:06:16 INFO]: Discovered module: ModuleSpec(name=cmd_list, file=modules\cmd_list.jar, provider=JenkinsModuleSource())

[20:06:16 INFO]: Discovered module: ModuleSpec(name=cmd_send, file=modules\cmd_send.jar, provider=JenkinsModuleSource())

[20:06:16 INFO]: Discovered module: ModuleSpec(name=cmd_server, file=modules\cmd_server.jar, provider=JenkinsModuleSource())
[20:06:16 INFO]: Discovered module: ModuleSpec(name=reconnect_yaml, file=modules\reconnect_yaml.jar, provider=JenkinsModuleSource())
[20:06:16 INFO]: Loaded plugin reconnect_yaml version git:reconnect_yaml:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:16 INFO]: Loaded plugin cmd_find version git:cmd_find:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:16 INFO]: Loaded plugin FastLogin version 1.10-git484855724b794de1fe057cf7360245362658b432 by games647, http://github.com/games647/FastLogin/graphs/contributors
[20:06:16 INFO]: Loaded plugin cmd_server version git:cmd_server:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:16 INFO]: Loaded plugin cmd_alert version git:cmd_alert:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:16 INFO]: Loaded plugin cmd_send version git:cmd_send:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:16 INFO]: Loaded plugin cmd_list version git:cmd_list:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:16 WARN]: Forced host server pvp is not defined
[20:06:16 INFO]: Enabled plugin reconnect_yaml version git:reconnect_yaml:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:16 INFO]: Enabled plugin cmd_find version git:cmd_find:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:16 INFO] [com.zaxxer.hikari.HikariDataSource]: HikariPool-1 - Starting...
[20:06:17 INFO] [com.zaxxer.hikari.HikariDataSource]: HikariPool-1 - Start completed.
[20:06:17 INFO]: Enabled plugin FastLogin version 1.10-git484855724b794de1fe057cf7360245362658b432 by games647, http://github.com/games647/FastLogin/graphs/contributors
[20:06:17 INFO]: Enabled plugin cmd_server version git:cmd_server:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:17 INFO]: Enabled plugin cmd_alert version git:cmd_alert:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:17 INFO]: Enabled plugin cmd_send version git:cmd_send:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:17 INFO]: Enabled plugin cmd_list version git:cmd_list:1.13-SNAPSHOT:92eb8b4:209 by WaterfallMC
[20:06:17 INFO]: Listening on /0.0.0.0:25566
[20:06:18 ERROR]: Exception in thread "main" com.sun.jna.LastErrorException: [127] The specified procedure could not be found.
[20:06:18 ERROR]:       at com.sun.jna.Native.invokeVoid(Native Method)
[20:06:18 ERROR]:       at com.sun.jna.Function.invoke(Function.java:408)
[20:06:18 ERROR]:       at com.sun.jna.Function.invoke(Function.java:354)
[20:06:18 ERROR]:       at com.sun.jna.Library$Handler.invoke(Library.java:244)
[20:06:18 ERROR]:       at org.jline.terminal.impl.jna.win.$Proxy16.SetConsoleMode(Unknown Source)
[20:06:18 ERROR]:       at org.jline.terminal.impl.jna.win.JnaWinSysTerminal.setConsoleMode(JnaWinSysTerminal.java:89)
[20:06:18 ERROR]:       at org.jline.terminal.impl.AbstractWindowsTerminal.updateConsoleMode(AbstractWindowsTerminal.java:206)
[20:06:18 ERROR]:       at org.jline.terminal.impl.AbstractWindowsTerminal.setAttributes(AbstractWindowsTerminal.java:192)
[20:06:18 ERROR]:       at org.jline.terminal.impl.AbstractTerminal.enterRawMode(AbstractTerminal.java:123)
[20:06:18 ERROR]:       at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:512)
[20:06:18 ERROR]:       at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:404)
[20:06:18 ERROR]:       at net.minecrell.terminalconsole.SimpleTerminalConsole.readCommands(SimpleTerminalConsole.java:157)
[20:06:18 ERROR]:       at net.minecrell.terminalconsole.SimpleTerminalConsole.start(SimpleTerminalConsole.java:140)
[20:06:18 ERROR]:       at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:61)
[20:06:18 ERROR]:       at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)

Oddly enough, this doesn't happen whilst running Paper

Linux nohup command make this library not work

Thank contributors for providing this library!
My native langauge is not English, so forgive me if I have some spell mistakes!

Recently, my software users reported that my software terminates when he tried to run my software using Linux command "nohup".
I asked for the log, the stacktrace mentions this library.
Full log see SNWCreations/KookBC#30 (Content excluding log is in Chinese)

It says that "Bad file descriptor"
So I tried to use java.io.FileDescriptor.valid method on System.in to check the stream.
However, it always return true as the result.

So I am reporting this issue here.

Before this got resolved, I am going to create a fork of this library, and i will remove the try-catch around the SimpleTerminalConsole.start method.

How to get every line which is being printed to the Terminal?

(This is a qeustion/suggestion, but I dont know how to mark as question)

If there is a message being printed to the Terminal, is there a way to get that line as String?
E.g.: logger.info("my message") and is there then any way, to get "my message" with the format (time and date) before the message itself?
So when something gets logged, I want to get it somewhere in Java as String

I appreciate any help

TCA#append(LogEvent) throws IllegalStateException after LineReader#readLine(String)

During normal logging, no issues seem to appear.

However, when submitting a message, this stacktrace is always thrown:

2017-06-25 23:40:29,706 main ERROR An exception occurred processing Appender Console java.lang.IllegalStateException
	at org.jline.reader.impl.LineReaderImpl.callWidget(LineReaderImpl.java:636)
	at net.minecrell.terminalconsole.TerminalConsoleAppender.append(TerminalConsoleAppender.java:269)
	at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448)
	at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433)
	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:403)
	at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
	at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
	at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2091)
	at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1993)
	at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1852)
	at org.apache.logging.slf4j.Log4jLogger.info(Log4jLogger.java:179)
	at tech.ferus.dungeonbot.DungeonBot.shutdown(DungeonBot.java:75)
	at tech.ferus.dungeonbot.commands.ConsoleListener.startReader(ConsoleListener.java:71)
	at tech.ferus.dungeonbot.Launcher.main(Launcher.java:115)

The stacktrace seems to be referring to:

reader.callWidget(LineReader.CLEAR);

When that line is commented out, the same error occurs but then points to:

reader.callWidget(LineReader.REDRAW_LINE);

And then:

reader.callWidget(LineReader.REDISPLAY);

It may be more apt to say that any calls to LineReader#callWidget(String) are resulting in an IllegalStateException.

It's worth noting, however, that the command/input DOES get processed correctly.

Declare a module name for use with JPMS

It would be nice for TerminalConsoleAppender to add a module descriptor (i.e. module-info.java), or at the very least, an Automatic-Module-Name during the interim before a full module descriptor is added.

The Velocity proxy, which uses TCA, has a possible future plan to use Jigsaw modules (I am not affiliated with that project however).

Cant export with maven

Hello,

I want to export the project with maven, but I always get the error, that it can't find the SimpleTerminalConsole class.

Here some helpful images of the artifacts and dependencies
and here the pom.xml

So I have no clue, what I've done wrong, I just want to export the file with maven

I appreciate every help

Timeline for next published release

An issue was fixed in a newer version of JLine than is included in the 1.1.1 TCA release.
It looks like master includes a version of JLine with the relevant bug fix. Is there any timeline or known blockers for the next release?

I'd be happy to help you test if that's a concern. Thanks, and thanks for TCA 👍

Deprecation of MinecraftFormattingConverter

TerminalConsoleAppender was never meant to be Minecraft-specific. It works just fine for other uses as well. The only Minecraft-specific code that it contains is the MinecraftFormattingConverter that is used to translate legacy color codes (§c etc) to ANSI color codes. I put that here because that was convenient back then when I needed the same code on multiple platforms.

But now legacy formatting codes have been deprecated for a long time, and there is no standard representation of newer features like RGB colors anymore. At this point, it seems easier if the projects that need it (and perhaps even want modern features like RGB support) make a copy of MinecraftFormattingConverter and change it to their needs. For example, Paper has made such a copy in PaperMC/Paper#5205.

As additional inspiration in case someone wants to implement this properly I will briefly describe a completely other, but potentially much cleaner approach that avoids legacy color codes entirely. I never found time to implement it, but I think it should work.

In particular, Log4j2 has the Message interface that can be passed to all log calls instead of a raw String. The idea would be to implement a custom Message class to retain all the properties of a text component (colors, hover events, ...), without having to serialize it into a raw string. Instead of logger.info(component.toLegacy()) you might use logger.info(new ComponentMessage(component)).
Then there is a sub-interface called MultiformatMessage, which can render itself differently based on the output it is appended to. So instead of having to strip color codes to log to a file, we can avoid generating them in the first place!

Something like this could be implemented once for a chat component API like adventure and then shared between projects that make use of adventure.

@zml2008 I believe we discussed this at some point? Did you ever finish implementing it? (I hope it was you, can't remember exactly and also can't find the chat log anymore. :D)

Can't get it to work

Hey Minecrell, I don't get this appender working.

Because of this, I want to ask, if you can give me any working example project.

So this isn't a true issue, because I don't get it to work, so its my fault. Srry for that

Have a great day^^

Doesn't work in executable jar

I've checked all the dependencies are in the jar...

Compiling the jar with gradle yields:

ERROR StatusLogger Unrecognized format specifier [d]
ERROR StatusLogger Unrecognized conversion specifier [d] starting at position 16 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [thread]
ERROR StatusLogger Unrecognized conversion specifier [thread] starting at position 25 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [level]
ERROR StatusLogger Unrecognized conversion specifier [level] starting at position 35 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [logger]
ERROR StatusLogger Unrecognized conversion specifier [logger] starting at position 47 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [msg]
ERROR StatusLogger Unrecognized conversion specifier [msg] starting at position 54 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [n]
ERROR StatusLogger Unrecognized conversion specifier [n] starting at position 56 in conversion pattern.

...And with intellij jar artifact:

2019-10-09 22:37:21,095 main ERROR Error processing element TerminalConsole ([Appenders: null]): CLASS_NOT_FOUND
2019-10-09 22:37:21,132 main ERROR Unable to locate appender "Console" for logger config "root"

Works fine in the IDE though :/

SimpleTerminalConsole will exit immediately if a terminal is not available.

I'm not sure if this is a bug, or an intended feature, but applications that use SimpleTerminalConsole will exit immediately if a pseudo TTY is not present.

I understand that taking input from std.in then quitting is useful in situations where you wish to consume all the available input, like running and interpreting a prebuilt script.

However, this results in Applications that use TCA's SimpleTerminalConsole to quit immediately when run as a sub-process that doesn't inherit a terminal (Such as Velocity).

Examples are:

Docker when unintentionally not wrapped in a pseudo tty using the -t flag
Gradle Application Run configurations.

If this behavior isn't treated as a bug, what workaround do you suggest to applications?

If not a workaround, can a feature be added to STC to act in a daemon mode, where it won't quit until it receives a signal? Or is that the responsibility of Applications using your library? And if so, what would you recommend?

Input characters are missing

Output the message while inputting the string, and the input characters will be lost
> xxxx
inputing the string and run(my log output is very fast)

log.info("a msg");

string will be lost.

Help wanted testing upgrade to JLine 3.20.0

In ddb7dc1 I updated TCA to use JLine 3.20.0 (from JLine 3.12.1 so far). It tested it briefly with ServerListPlusServer (which uses TCA now too \o/) on Linux and it seems to work just fine.

But in the past JLine/Jansi/... upgrades have often caused some weird regressions, particularly on Windows so it would be good to have some more testing. I don't really use Windows/macOS/whatever anymore so I could use some help to make sure that it works well on other platforms as well. :)

I'm hoping some people from the projects using TCA can help test this to make sure it works well before I tag a new release. The upgrade is in the latest TCA 1.3.0-SNAPSHOT that you can get from https://oss.sonatype.org/content/repositories/snapshots/. Don't forget to update org.jline:jline-terminal-jansi (or JNA) to 3.12.0 as well.

FWIW, pinging some people who might be interested to avoid regressions in TCA :) @electronicboy @zml2008 @astei

LoggerNamePatternSelector ignores -Dterminal.ansi=false and TerminalConsoleAppender#isAnsiSupported

When a unsupported console is used it displays Advanced terminal features are not available in this environment but ANSI escape is printed out.

I have tried to disable ansi output using both -Dterminal.ansi=false and -Dterminal.jline=false but the issues persists.

Below is an example log,

MinecraftForge 1.15.2 on MultiMC 0.6.12

2020-03-29 XX:26:56,283 main WARN Advanced terminal features are not available in this environment
�[32m[XX:26:56] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, REDACTED, --version, MultiMC5, --gameDir, REDACTED, --assetsDir, REDACTED, --assetIndex, 1.15, --uuid, <PROFILE ID>, --accessToken, ????????, --userType, mojang, --versionType, release, --launchTarget, fmlclient, --fml.forgeVersion, 31.1.30, --fml.mcVersion, 1.15.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20200307.202953, --width, 854, --height, 480]
�[m�[32m[XX:26:56] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 5.0.0-milestone.4+67+b1a340b starting: java version 1.8.0_231 by Oracle Corporation
�[m�[32m[XX:26:56] [main/INFO] [ne.mi.fm.lo.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
�[m�[32m[XX:26:58] [main/INFO] [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmlclient' with arguments [--version, MultiMC5, --gameDir, REDACTED, --assetsDir, REDACTED, --uuid, <PROFILE ID>, --username, REDACTED, --assetIndex, 1.15, --accessToken, ????????, --userType, mojang, --versionType, release, --width, 854, --height, 480]
�[m�[32m[XX:27:00] [Render thread/INFO] [minecraft/Minecraft]: Setting user: REDACTED
�[m�[32m[XX:27:10] [Render thread/INFO] [minecraft/Minecraft]: Backend library: LWJGL version 3.2.2 build 10
�[m�[32m[XX:27:13] [modloading-worker-1/INFO] [ne.mi.co.ForgeMod/FORGEMOD]: Forge mod loading, version 31.1.30, for MC 1.15.2 with MCP 20200307.202953
�[m�[32m[XX:27:13] [modloading-worker-1/INFO] [ne.mi.co.MinecraftForge/FORGE]: MinecraftForge v31.1.30 Initialized
�[m�[32m[XX:27:16] [Render thread/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded
�[m�[32m[XX:27:16] [Render thread/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, Mod Resources
�[m�[32m[XX:27:28] [Forge Version Check/INFO] [ne.mi.fm.VersionChecker/]: [forge] Starting version check at https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
�[m�[32m[XX:27:29] [Forge Version Check/INFO] [ne.mi.fm.VersionChecker/]: [forge] Found status: AHEAD Current: 31.1.30 Target: null

MinecraftForge 1.14.4 on Legacy Jar Launcher

2020-03-29 XX:21:35,751 main WARN Advanced terminal features are not available in this environment
�[32m[XX:21:35] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, REDACTED, --version, 1.14.4-forge-28.2.0, --gameDir, REDACTED, --assetsDir, REDACTED, --assetIndex, 1.14, --uuid, REDACTED, --accessToken, ????????, --userType, legacy, --versionType, release, --launchTarget, fmlclient, --fml.forgeVersion, 28.2.0, --fml.mcVersion, 1.14.4, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20190829.143755]
�[m�[32m[XX:21:35] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 4.1.0+62+5bfa59b starting: java version 1.8.0_231 by Oracle Corporation
�[m�[32m[XX:21:36] [main/INFO] [ne.mi.fm.lo.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
�[m�[32m[XX:21:37] [main/INFO] [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmlclient' with arguments [--version, 1.14.4-forge-28.2.0, --gameDir, REDACTED, --assetsDir, REDACTED, --uuid, REDACTED, --username, REDACTED, --assetIndex, 1.14, --accessToken, ????????, --userType, legacy, --versionType, release]
�[m�[32m[XX:21:40] [Client thread/INFO] [minecraft/Minecraft]: Setting user: REDACTED
�[m�[33m[XX:21:52] [Client thread/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
�[m�[32m[XX:21:52] [Client thread/INFO] [minecraft/Minecraft]: LWJGL Version: 3.2.2 build 10
�[m�[32m[XX:21:54] [modloading-worker-1/INFO] [ne.mi.co.ForgeMod/FORGEMOD]: Forge mod loading, version 28.2.0, for MC 1.14.4 with MCP 20190829.143755
�[m�[32m[XX:21:54] [modloading-worker-1/INFO] [ne.mi.co.MinecraftForge/FORGE]: MinecraftForge v28.2.0 Initialized
�[m�[32m[XX:21:58] [Client thread/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded

This is the log4j2 configuration for 1.15 and 1.14 https://github.com/MinecraftForge/MinecraftForge/blob/2f5172f907a74a04dbac9cd28b9507079951bf2b/src/fmllauncher/resources/log4j2.xml#L22-L28

Workaround:
Manually load a custom log4j2 configuration with property disableAnsi or noConsoleNoAnsi on LoggerNamePatternSelector fixes it. (Edit: added noConsoleNoAnsi)

Colors not working

Hi, i am trying to use that library on my standalone project. However Minecraft Formatting (i know it is deprecated, but i want to use it) is not working as expected

  1. Not working in intellij, while log4j's highlight colors are working perfectly, and it works if i use the override property
  2. I am getting a weird character in the place of the color code, even if colors aren't even applied:
    image

Am i doing something incorrectly?

Issue with log4j 2.18.0

The last working log4j is 2.17.1.

If using 2.18.0 I receive the following stack trace:

2022-09-04 20:05:35,751 main WARN The style attribute disableAnsi=false is incorrect. java.lang.IllegalArgumentException: No enum constant org.apache.logging.log4j.core.pattern.AnsiEscape.DISABLEANSI=FALSE
        at java.base/java.lang.Enum.valueOf(Enum.java:240)
        at org.apache.logging.log4j.util.EnglishEnums.valueOf(EnglishEnums.java:67)
        at org.apache.logging.log4j.util.EnglishEnums.valueOf(EnglishEnums.java:50)
        at org.apache.logging.log4j.core.pattern.AnsiEscape.createSequence(AnsiEscape.java:486)
        at org.apache.logging.log4j.core.pattern.StyleConverter.newInstance(StyleConverter.java:96)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.logging.log4j.core.pattern.PatternParser.createConverter(PatternParser.java:590)
        at org.apache.logging.log4j.core.pattern.PatternParser.finalizeConverter(PatternParser.java:657)
        at org.apache.logging.log4j.core.pattern.PatternParser.parse(PatternParser.java:420)
        at org.apache.logging.log4j.core.pattern.PatternParser.parse(PatternParser.java:177)
        at org.apache.logging.log4j.core.layout.PatternLayout$SerializerBuilder.build(PatternLayout.java:473)
        at org.apache.logging.log4j.core.layout.PatternLayout.<init>(PatternLayout.java:139)
        at org.apache.logging.log4j.core.layout.PatternLayout.<init>(PatternLayout.java:60)
        at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:766)
        at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:626)
        at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:124)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1133)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1058)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1050)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1050)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:659)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:257)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:303)
        at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
        at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:599)
        at au.com.grieve.reversion.platform.standalone.Standalone.<clinit>(Standalone.java:49)

log4j.xml

<Configuration status="WARN">
    <Appenders>
        <TerminalConsole name="TerminalConsole">
            <PatternLayout pattern="[%d{HH:mm:ss} %style{%highlight{%-5level}{FATAL=red dim, ERROR=red, WARN=yellow bright, INFO=cyan bright, DEBUG=green, TRACE=white}}] %msg%n" disableAnsi="${tca:disableAnsi}"/>
        </TerminalConsole>


        <RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
            <PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
            <Policies>
                <TimeBasedTriggeringPolicy/>
                <OnStartupTriggeringPolicy/>
            </Policies>
        </RollingRandomAccessFile>
    </Appenders>

    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="TerminalConsole"/>
            <AppenderRef ref="File"/>
        </Root>
    </Loggers>
</Configuration>

Error while reading line

2017-10-10 00:43:40,453 main ERROR An exception occurred processing Appender Console java.lang.IllegalStateException
        at org.jline.reader.impl.LineReaderImpl.callWidget(LineReaderImpl.java:651)
        at net.minecrell.terminalconsole.TerminalConsoleAppender.append(TerminalConsoleAppender.java:265)
        at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
        at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448)
        at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433)
        at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
        at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:403)
        at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
        at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
        at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2116)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2100)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1994)
        at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1966)
        at org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1303)
        at de.dawnstudios.nnxcloud.main.Main.launch(Main.java:142)
        at de.dawnstudios.nnxcloud.main.Main.main(Main.java:40)

Race condition when logging message while JLine is not reading input

Related to PaperMC/Waterfall#188, PaperMC/Paper#1093

There is a possible race condition when logging a message using TerminalConsoleAppender, while the JLine LineReader is changing state (e.g. shortly before it starts reading or shortly after).

This results in an error when re-drawing the input prompt:

// Draw the prompt line again if a reader is available
reader.callWidget(LineReader.CLEAR);
terminal.writer().print(getLayout().toSerializable(event));
reader.callWidget(LineReader.REDRAW_LINE);
reader.callWidget(LineReader.REDISPLAY);

ERROR An exception occurred processing Appender TerminalConsole java.lang.IllegalStateException
	at org.jline.reader.impl.LineReaderImpl.callWidget(LineReaderImpl.java:651)
	at net.minecrell.terminalconsole.TerminalConsoleAppender.append(TerminalConsoleAppender.java:265)
	at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.