How to run in production mode?

722 views
Skip to first unread message

Renato Forti

unread,
Jul 4, 2014, 2:13:35 PM7/4/14
to mojol...@googlegroups.com
Hi, All,

How I can deactivate debug log of my server! Put it on production!

I did try this:

$self->mode('production'); # on lib/MyApp.pm

But log continues like this:

[Fri Jul  4 15:07:14 2014] [debug] Rendering template "PDDBx002-fav-pt-br.html.ep".
Use of uninitialized value in string eq at template build.html.ep line 389.
[Fri Jul  4 15:07:14 2014] [debug] Rendering template "PDDBx002-header-pt-br.html.ep".
"my" variable $size masks earlier declaration in same scope at template PDDBx002-header-pt-br.html.ep line 76.
[Fri Jul  4 15:07:14 2014] [debug] Rendering template "auth-check.html.ep". Use of uninitialized value $did in string eq at template auth-check.html.ep line
 15.
Use of uninitialized value in string ne at template PDDBx002-header-pt-br.html.ep line 9.
[Fri Jul  4 15:07:14 2014] [debug] Template "PDDBx002-extended-page.html.ep" not found.
Use of uninitialized value $extended_page in string eq at template build.html.ep line 406.
[Fri Jul  4 15:07:14 2014] [debug] Rendering template "default-page.html.ep".
[Fri Jul  4 15:07:14 2014] [debug] Template "PDDBx002-left-menu-default-pt-br.html.ep" not found.
Use of uninitialized value $left_menu_default_render in string eq at template default-page.html.ep line 15.
[Fri Jul  4 15:07:14 2014] [debug] Rendering template "left-menu-default-pt-br.html.ep".
[Fri Jul  4 15:07:14 2014] [debug] Rendering template "PDDBx002-left-menu-pt-br.html.ep".
[Fri Jul  4 15:07:14 2014] [debug] Rendering template "PDDBx002-pt-br.html.ep".Use of uninitialized value in string eq at template PDDBx002-pt-br.html.ep line 13.

Thanks

Neil Watson

unread,
Jul 4, 2014, 2:27:33 PM7/4/14
to mojol...@googlegroups.com
On Fri, Jul 04, 2014 at 11:13:35AM -0700, Renato Forti wrote:
> How I can deactivate debug log of my server! Put it on production!
> I did try this:

Are you using morbo or hypnotoad?

> [Fri Jul  4 15:07:14 2014] [debug] Rendering template
> "PDDBx002-fav-pt-br.html.ep".
> Use of uninitialized value in string eq at template build.html.ep line
> 389.

This seems a legitimate error to me. Initialized the vars properly.

--
Neil Watson
Linux/UNIX Consultant
http://watson-wilson.ca

Jan Henning Thorsen

unread,
Jul 5, 2014, 2:52:49 AM7/5/14
to mojol...@googlegroups.com
I would say setting $app->mode("...") is a bad idea. You probably want to change the mode from the outside instead. Try setting MOJO_MODE before starting the application:

  MOJO_MODE=production ./script/yourapp daemon --listen http://*:3000


The operating mode for your application, defaults to a value from the MOJO_MODE and PLACK_ENV environment variables or development. Right before calling "startup",Mojolicious will pick up the current mode, name the log file after it and raise the log level from debug to info if it has a value other than development.

The only exception to the rule above is that "hypnotoad" set MOJO_MODE to "production" unless set to something else from the outside.

Jan Henning Thorsen

unread,
Jul 5, 2014, 8:22:11 AM7/5/14
to mojol...@googlegroups.com
I should probably also mention MOJO_LOG_LEVEL that you can set to your desired level:

 MOJO_LOG_LEVEL=info MOJO_MODE=production ./script/yourapp daemon --listen http://*:3000

Renato Forti

unread,
Jul 5, 2014, 9:50:48 AM7/5/14
to mojol...@googlegroups.com, ne...@watson-wilson.ca
Thanks for help!

>> Are you using morbo or hypnotoad? 
I don't know! how to check?

I will fix vars, thanks1

Renato Forti

unread,
Jul 5, 2014, 9:53:54 AM7/5/14
to mojol...@googlegroups.com
Thanks for help, well, my app is configured on apache, like this:


sudo vi /etc/apache2/httpd.conf

# ---------------------------
<Perl>
  use Plack::Handler::Apache2;
  Plack::Handler::Apache2->preload("/x1/htdocs/zones/sa/east/1a/myapp/script/myapp");
</Perl>

<Location /cloud>
   SetHandler perl-script
   PerlHandler Plack::Handler::Apache2
   PerlSetVar psgi_app /x1/htdocs/zones/sa/east/1a/myapp/script/myapp
</Location>
# ---------------------------

How to do this, in this env?

Tekki

unread,
Jul 5, 2014, 10:51:00 AM7/5/14
to mojol...@googlegroups.com
<Perl>
  ...
 $ENV{MOJO_MODE} = 'production';
  ...
</Perl>

https://github.com/kraih/mojo/wiki/Apache-deployment#apachemod_perl-psgiplack
Reply all
Reply to author
Forward
0 new messages