0

Is it possible to disable core bundles of Symfony 2, such as the Monolog logger?

I am working on an application which doesn't have many fancy requirements except that it should be ultra fast and as much lightweight as possible. I guess Symfony 2 is not the best framework to go with in my situation, but for me it uses the best principles there are, it is a pleasure to work with and also there are many bundles I might take advantage of later on.

So, my question is as in the title, is it possible to completely disable logging (in the production environment at least), and if it is, would it be possible to disable other such features as well?

P.S.: I understand that the easiest and cleanest way to disable a bundle is to remove it from the kernel, but what happens with the code which uses it?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Tony Bogdanov
  • 7,436
  • 10
  • 49
  • 80
  • 2
    I came here because I needed to know how to disable monolog for a specific environment but was totally misled by your question's title. I eventually found the answer myself. So if you want to know how to disable monolog please try this http://stackoverflow.com/questions/10348285/yaml-symfony2-override-configurations/13347822#13347822 – flu Nov 12 '12 at 16:56

1 Answers1

0

Actually, Symfony2 is perfect for what you want. As it is a decoupled framework, you can just include the features you want. You can disable monolog from config files.

Also, there is Silex, a micro-framework built with Symfony components, designed to be lightweight and fast for relatively small jobs.

Hakan Deryal
  • 2,843
  • 1
  • 20
  • 19
  • Yes I was just reading the docs of Silex, but it turns out to be too small :D I would like to take advantage of the fos/knp symfony bundles though.. I figured out how to disable monolog, but again, it turned out that monolog wasn't causing almost any overhead. Any other lightweight-ifying tips? – Tony Bogdanov Apr 05 '12 at 19:45
  • Well, I can't say anything without seeing how your project is performing. The Symfony2 base code is already fast and micro optimised in lots of areas. Fabien Potencier, the creator of Symfony, has a series of blog posts in his blog (http://fabien.potencier.org/) , explaining building a framework with Symfony components. You can check them to understand how Symfony works, than you can only use the components you really need to improve performance further. You can use the debug toolbar and profiler to look for bottlenecks and improve the code to remove them. – Hakan Deryal Apr 05 '12 at 20:39
  • I guess I shouldn't worry about it. I already have a medium heavy project based on symfony 2 (not very good coded - it's my first), which usually takes 50-60 ms to load on the prod server. The whole problem comes from the fact that at my laptop (in dev env) the plain Acme Demo bundle takes >1s to load, which is quite slow for development. The other project goes as far as 4s with my code, still I guess it's better to optimize the bundle and the server, or pay for additional CPU power rather than searching for ways to optimize what's already optimized to the limit (Symfony 2). Thanks! – Tony Bogdanov Apr 05 '12 at 21:23