circuits / irclogger

Distributed IRC Logger and Web Application
4 stars 3 forks source link

Problem with log rotation #5

Closed prologic closed 9 years ago

prologic commented 9 years ago

There seems to be an issue with log rotation with channels with dashes*.

prologic commented 9 years ago

Hmm I'm not seeing an issue with the code here (het).

We already log several channels with dashses in them:

http://irclogs.shortcircuit.net.au/%23crux-devel/

jibanes commented 9 years ago

It's noteworthy to comment that my "output" file resides on nfs.

jibanes commented 9 years ago

My command line: export USER=mybot irclogger -o /mypath/irc -c '#cat-v' irc.freenode.net

prologic commented 9 years ago

NFS eh? I can reproduce this at home then on my new shiny NAS :) I'll do some testing...

prologic commented 9 years ago

Thanks @jibanes -- Expect to see a duplicate logger join your chan :)

jibanes commented 9 years ago

Could it be a bug in circuits? I'm using 3.1.0 and python 2.7.3

jibanes commented 9 years ago

Oh sorry, I didn't know you wrote circuits too, nevermind that...

jibanes commented 9 years ago

modified filename (strftime("%Y-%m-%d-%H-%M-%S", localtime())))

and setting this in "init" doesn't rotate it either:

    #interval = datetime.fromordinal((
    #    date.today() + timedelta(1)
    #).toordinal())
    interval = 60
    Timer(interval, rotate(), self.channel).register(self)
jibanes commented 9 years ago

rotate does get called properly.

jibanes commented 9 years ago

I confirm the issue has nothing to do with presence of '-' in channel name.

jibanes commented 9 years ago

there's only one explanation, this is the issue: self.fire(open(path.join(dirname, logfile), "a"), self.channel)

jibanes commented 9 years ago

dirname and logfile are properly set.

jibanes commented 9 years ago

though this works: self.fire(close(), self.channel)

jibanes commented 9 years ago

this doesn't look right: LOGFILE_REGEX = compileregex("^(.).(._).log$") note: apparently github doesn't display this right either

why do you have a dot between the captures? ok I see why: logger.#channel

jibanes commented 9 years ago

is seems that generate_logfile returns something different from what parse_logfile provides.

prologic commented 9 years ago

I think I may have figured this out.

I've cleaned up some of the code in some places that were obviously just plain wrong and overly complex for what they were doing. Essentially removing parse_logfile() which wasn't doing anything useful at all.

prologic commented 9 years ago

I'll test locally and hopefully commit and push a fix you can test with

prologic commented 9 years ago

I don't think NFS should have any bearing at all IHMO

jibanes commented 9 years ago

thanks

On Sun, Apr 12, 2015 at 11:47 PM, James Mills notifications@github.com wrote:

I don't think NFS should have any bearing at all IHMO

— Reply to this email directly or view it on GitHub https://github.com/circuits/irclogger/issues/5#issuecomment-92232895.

prologic commented 9 years ago

Hmm it didn't rotate and stopped logging as you described :(

prologic commented 9 years ago

I won't know for sure whether this is fixed until Tuesday 14th 00:00 AEST tonight or unless I fake the time and do some unit testing, etc; but hopefully this does fix the issue. I think the filenames weren't generated properly. Please give this a try and let me know how it goes!

prologic commented 9 years ago

This still hasn't fixed it (yet) :/

prologic commented 9 years ago

Closed via abc04225d0f171dece3748d9a52b2a81213c8291