Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Delete logs automatically?

Junior Spellweaver
Joined
May 7, 2023
Messages
103
Reaction score
16
1685358012646.png


Is there a way to have it set up to delete these logs daily or upon closing the client?
I would like them to do logs while the server is online, but delete them whenever I close the server for the day/night.
 
"One day at a time"
[VIP] Member
Joined
Sep 21, 2013
Messages
2,310
Reaction score
2,403
Is there a way to have it set up to delete these logs daily or upon closing the client?
I would like them to do logs while the server is online, but delete them whenever I close the server for the day/night.
Yeah man, you really need to delete them periodically.
I myself have not found another way :unsure:
 
Joined
Mar 29, 2019
Messages
785
Reaction score
851
View attachment 236306

Is there a way to have it set up to delete these logs daily or upon closing the client?
I would like them to do logs while the server is online, but delete them whenever I close the server for the day/night.

I suggest you to do this modification first,

Edit ServerConfig.xml and go to "LogConfig" node and leave it as this,

Code:
<LogConfig>
    <Directories>
      <Directory name="Logging" path=".\Logs\Logging" />
      <Directory name="Logged" path=".\Logs\Logged" />
      <Directory name="ChatLogging" path=".\Logs\ChatLogging" />
      <Directory name="ChatLogged" path=".\Logs\ChatLogged" />
      <Directory name="NHNChat" path=".\Logs\NHNChatLog" />
      <Directory name="Console" path=".\Logs\" />
      <Directory name="UserDump" path=".\Logs\UserDump" />
    </Directories>
    <DisabledChatType />
  </LogConfig>

This will make that all logs will be placed at Logs folder and not in the root bin folder.

About the task,

Create a "CleanLogs.ps1" file with the following content,

Code:
Get-ChildItem -Path "D:\TERA_SERVER" -Recurse -Include *.log,*.log2 -Force | Remove-Item -Force

and create a batch file with the following content,

Code:
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'D:\TERA_SERVER\CleanLogs.ps1'"

Save it as CleanLogFile.bat (or what ever you want)

Then add it (CleanLogFile.bat) to your windows task scheduler
 
Last edited:
Junior Spellweaver
Joined
May 7, 2023
Messages
103
Reaction score
16
Yeah man, you really need to delete them periodically.
I myself have not found another way :unsure:
Yup, they add up real fast if you're restarting the server 10x+ a day working on things, like I do :p

Gets annoying, I wish they'd auto-delete upon shutting down the server each time.

I suggest you to do this modification first,

Edit ServerConfig.xml and go to "LogConfig" node and leave it as this,

Code:
<LogConfig>
    <Directories>
      <Directory name="Logging" path=".\Logs\Logging" />
      <Directory name="Logged" path=".\Logs\Logged" />
      <Directory name="ChatLogging" path=".\Logs\ChatLogging" />
      <Directory name="ChatLogged" path=".\Logs\ChatLogged" />
      <Directory name="NHNChat" path=".\Logs\NHNChatLog" />
      <Directory name="Console" path=".\Logs\" />
      <Directory name="UserDump" path=".\Logs\UserDump" />
    </Directories>
    <DisabledChatType />
  </LogConfig>

This will make that all logs will be placed at Logs folder and not in the root bin folder.

About the task,

Create a "CleanLogs.ps1" file with the following content,

Code:
Get-ChildItem -Path "D:\TERA_SERVER" -Recurse -Include *.log,*.log2 -Force | Remove-Item -Force

and create a batch file with the following content,

Code:
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'D:\TERA_SERVER\CleanLogs.ps1'"

Save it as CleanLogFile.bat (or what ever you want)

Then add it (CleanLogFile.bat) to your windows task

Thanks, I'll try some of this as it seems mine isn't set up.
1685372785116.png
 
"One day at a time"
[VIP] Member
Joined
Sep 21, 2013
Messages
2,310
Reaction score
2,403
It needs to be deleted anyway, but it's worth a try.
 
Joined
Mar 29, 2019
Messages
785
Reaction score
851
Here's some screenshots to configure the windows task,

Screenshot-203.png


This will trigger the task to execute every 6hrs, if you only want to delete logs daily then uncheck "Repeat Task every..."

Screenshot-204.png


Screenshot-205.png


Screenshot-206.png
 
"One day at a time"
[VIP] Member
Joined
Sep 21, 2013
Messages
2,310
Reaction score
2,403
Code:
<LogConfig>
    <Directories>
      <Directory name="Logging" path=".\Logs\Logging" />
      <Directory name="Logged" path=".\Logs\Logged" />
      <Directory name="ChatLogging" path=".\Logs\ChatLogging" />
      <Directory name="ChatLogged" path=".\Logs\ChatLogged" />
      <Directory name="NHNChat" path=".\Logs\NHNChatLog" />
      <Directory name="Console" path=".\Logs\" />
      <Directory name="UserDump" path=".\Logs\UserDump" />
    </Directories>
    <DisabledChatType />
  </LogConfig>
Good idea!! That's enough for me...
Thanks argeus99
 
Junior Spellweaver
Joined
May 7, 2023
Messages
103
Reaction score
16
Here's some screenshots to configure the windows task,

Screenshot-203.png


This will trigger the task to execute every 6hrs, if you only want to delete logs daily then uncheck "Repeat Task every..."

Screenshot-204.png


Screenshot-205.png


Screenshot-206.png
Yeah thanks a lot for this! This will definitely help :)
 
Back
Top