User Name
Password
AppleNova Forums » Programmer's Nook »

Need help splitting output with logger and stdout


Register Members List Calendar Search FAQ Posting Guidelines
Need help splitting output with logger and stdout
Thread Tools
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2021-12-17, 19:23

Like the thread title says I need help figuring out how to split the output between stdout and logger. I have a syslog server running and have started using it for my logging with the help of the app, logger. This means I don't have to go to smaller directories to find the log nor do I have to manage the little log files scattered all over various servers. Scripts now log to the log server etc.

For Minecraft though this current plan is a problem...sort of. This is a basic invocation of the MC server with the output going to logger.
Code:
ExecStart=/usr/bin/screen -dmS MineCraft bash -c '/usr/bin/java -Xms1024M -Xmx1024M -jar minecraft.jar nogui | logger -p info -t homemcserver -n 10.0.0.11'
It does a great job sending the text to the remote logging server but it doesn't show anything in the screen session. That isn't really shocking given all content is directed to the remote logging server.

I tried variations with "tee" but that doesn't seem to work since tee wants to send to a text file. So something like this produces no output other than the game server is running:
Code:
ExecStart=/usr/bin/screen -dmS MineCraft bash -c '/usr/bin/java -Xms1024M -Xmx1024M -jar minecraft.jar nogui | tee | logger -p info -t homemcserver -n 10.0.0.11'
This one also doesn't work though it does create a file named "logger" that gets no content because "tee" doesn't recognize the "-p" flag but the game server is running:
Code:
ExecStart=/usr/bin/screen -dmS MineCraft bash -c '/usr/bin/java -Xms1024M -Xmx1024M -jar minecraft.jar nogui | tee > logger -p info -t homemcserver -n 10.0.0.11'
So is there a way that I can have the logging from the MC server go to the screen session stdout as well as the logger application for forwarding to the remote logging server?

While we manage most of the operations of the server without logging into the screen session, it would be nice if the session had text visible for the times we would need to manage the server from the console.

Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.”
MineCraft? mc.applenova.com | Visit us! | Maybe someday I'll proof read, until then deal with it.
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2021-12-18, 14:19

So far it looks something like this using log4j (of all things):
Code:
/usr/bin/screen -dmS MineCraft bash -c /usr/bin/java -Xms1024M -Xmx1024M -Dlog4j.configurationFile=log4j2.xml -Dlog4j2.formatMsgNoLookups=true -jar minecraft.jar nogui
Code:
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="WARN" name="homemcserver"> <Appenders> <Console name="STDOUT" target="SYSTEM_OUT"> <PatternLayout pattern="%m%n"/> </Console> <Syslog name="RFC5424" format="RFC5424" host="10.10.0.11" port="514" protocol="UDP" appName="homemcserver" includeMDC="true" facility="USER" newLine="true" messageId="info" id="homemcserver"/> <RollingFile name="rolling_server_log" fileName="logs/latest.log" filePattern="logs/server_%d{yyyy-MM-dd}.log"> <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n" /> <Policies> <TimeBasedTriggeringPolicy /> </Policies> </RollingFile> </Appenders> <Loggers> <Root level="info"> <AppenderRef ref="STDOUT"/> <AppenderRef ref="RFC5424"/> <AppenderRef ref="rolling_server_log" /> </Root> </Loggers> </Configuration>

Last edited by turtle : 2021-12-18 at 14:52.
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
SIMPLE GPS track logger iOS app? Dorian Gray Purchasing Advice 3 2013-11-18 08:52
Splitting WMV Files PKIDelirium General Discussion 2 2008-02-27 20:44
California splitting from the US? chucker AppleOutsider 39 2007-02-15 06:05
Splitting VOB Files? MagSafe Third-Party Products 7 2006-09-09 17:57
splitting a disk Mac+ Genius Bar 12 2004-11-30 18:50


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 16:51.


Powered by vBulletin®
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2022, AppleNova