- Home /
Prevent editor-prev.log file from getting too big
So there are lots of people who've noted that the editor-prev.log filesize can get huge.
Obviously there's lots of value to looking at it to find out why it's so big, but folks are regularly complaining that it gets so big that they can't even open it without splitting the file up somehow. My computer recently crashed after the file suddenly ballooned to almost 300gb.
Is there any way to prevent the file from getting so big in the first place? Maybe capping it at 10gb or whatever?
What os are you on? Regularly deleting it is pretty trivial but you can automate the process in a bunch of different ways.
Win 10 64-bit, though I also use a $$anonymous$$acbook pretty frequently (El Capitan, I think).
Cheers. I'd considered automated deletion, though I don't know how to automate deletion based on filesize. When the file grew to ~300gb for me, it happened within a few $$anonymous$$utes without me noticing until crash. A time-scheduled deletion wouldn't really help there - hence wanting to cap it.
on the mac you can use automator to create a file watcher to do it. on windows you could write a file watching service to do it too.
https://docs.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?view=netframework-4.8
I think if you have that many editor errors you are doing something really really wrong in your code but it may be mostly accumulative in which case writing something that on system start or ending a user session deletes the file will probably keep it in check if its not already a temporary file.
Answer by Bunny83 · Jan 29, 2020 at 10:29 AM
Sorry but 300 gb log file means you do something wrong ^^. It's not the "editor-prev.log" that gets that big, it's your actual editor log file. Unity will rename the old editor log to editor-pref.log at start. Have you ever bothered to look into that log to see what's taking up that much space? That sounds like you have a bazillion Debug.Log / print calls per frame or that you somehow generate countless of warnings or errors. You should find the root of your problem instead of trying to fix the symptoms.
Each time you restart the Unity editor you start with a new empty editor log. So if your log grows to 300+GB that has to happen within the same session. About opening / handling of large log files, there are plenty of solutions out there like this one (first result after a 2 second google search). Anyways as I said you should find and fix the cause of your exploding log file rather than patching around that symptom.
Thanks! Turns out it was something with ProBuilder that suddenly sent a deluge of errors my way, I managed to reproduce it once playing around in the UV editor but haven't been able to since. Not super fixable on my end, @sacredgeometry noted above how to do some methods to prevent that from happening. Good to know the log gets refreshed every time Unity is rebooted though :)