How can I customize my log dir location

640 visualizzazioni
Passa al primo messaggio da leggere

Александер Пономарёв

da leggere,
27 feb 2012, 21:20:4427/02/12
a mojol...@googlegroups.com
Hi,
I want to change the log directory of my project to another place, is
there anybody knows, how can I do that?
$self->log->path on startup doesn't work.

Wes Cravens

da leggere,
27 feb 2012, 21:59:0227/02/12
a mojol...@googlegroups.com

If your are on a *nix system you can use filesystem level links. I.e.
linking your my_app/log directory to the system location of your choice.
You may even be able to do this on other systems but I don't know.

For example:

cd my_app
ln -s /var/log/mojo/my_app log

Make sure filesystem permissions are correct.

Also $self->log->path seems like it is meant to change the path of the
log _file_ not the log _directory_. But I could be missing something.

With a quick test I managed to move my log file to various files under
various directories with $self->log->path('/foo/bar/baz.log') etc in
startup. The only problem I ran into were system permissions (but
that's to be expected).

Wes

Abhijit Menon-Sen

da leggere,
28 feb 2012, 13:11:4528/02/12
a mojol...@googlegroups.com

Don't do it in startup, do it in your xxx_mode subs:

sub development_mode {
shift->log->path(undef);
}

sub production_mode {
shift->log->path('/my/log/file');
}

sub startup {

}

-- ams

Александер Пономарёв

da leggere,
28 feb 2012, 13:39:4828/02/12
a mojol...@googlegroups.com
Thanks, I didn't think about it, thank you very much!

2012/2/29 Abhijit Menon-Sen <a...@toroid.org>:

> --
> You received this message because you are subscribed to the Google Groups "Mojolicious" group.
> To post to this group, send email to mojol...@googlegroups.com.
> To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
>

James B

da leggere,
4 lug 2013, 15:13:1704/07/13
a mojol...@googlegroups.com
shootnix,

Did that ever work for you? I have tried to set app->log->path in startup and production_mode, and I have tried setting it to a path and a file. So far I haven't had any luck getting hypnotoad to log anything unless I keep it in the foreground, and then it logs to stdout. I guess I could run it in production mode and pipe the output, but that seems kind of silly.

Does anybody else have any suggestions, other than keeping hypnotoad in the foregorund and piping the output?

James

Roland Lammel

da leggere,
5 lug 2013, 06:13:4605/07/13
a mojol...@googlegroups.com
In your application folder just do a "mkdir log" and you should be fine.
Logs by default will be going to log/development.log and log/production.log

I'm using Log::Any and Log4perl for my logging needs, so I get around that usually and have to specify the location anyway. I prefer that for producation use.

BR

+rl
--
Roland Lammel
QuikIT - IT Lösungen - flexibel und schnell
Web: http://www.quikit.at
Phone: +43 (676) 9737845
Email: r...@quikit.at

"Enjoy your job, make lots of money, work within the law. Choose any two."


To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious...@googlegroups.com.

To post to this group, send email to mojol...@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi