Changeset - 0d4dd9380a45
[Not reviewed]
default
0 1 0
Thomas De Schampheleire - 9 years ago 2017-03-20 21:06:31
thomas.de.schampheleire@gmail.com
config: activate logging on 'gearbox serve'

With the switch from paster to gearbox, early logging did not show on the
console anymore. This includes the initialization logging of TurboGears2.

For our own gearbox commands, the activation of logging is done in
kallithea/lib/paster_commands/common.py:_bootstrap_config, but for 'serve'
this method is not used. 'gearbox serve' immediately runs the
'paste.app_factory' specified in setup.py, which is make_app.

Extend make_app with logging initialization in the same way as is done in
_bootstrap_config.
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/config/middleware.py
Show inline comments
 
@@ -4,24 +4,25 @@
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""WSGI middleware initialization for the Kallithea application."""
 

	
 
import logging
 
from kallithea.config.app_cfg import base_config
 
from kallithea.config.environment import load_environment
 

	
 
__all__ = ['make_app']
 

	
 
# Use base_config to setup the necessary PasteDeploy application factory.
 
# make_base_app will wrap the TurboGears2 app with all the middleware it needs.
 
make_base_app = base_config.setup_tg_wsgi_app(load_environment)
 

	
 

	
 
def make_app(global_conf, full_stack=True, **app_conf):
 
    """
 
@@ -32,14 +33,15 @@ def make_app(global_conf, full_stack=Tru
 
        defined under the ``[DEFAULT]`` section).
 
    :type global_conf: dict
 
    :param full_stack: Should the whole TurboGears2 stack be set up?
 
    :type full_stack: str or bool
 
    :return: The Kallithea application with all the relevant middleware
 
        loaded.
 

	
 
    This is the PasteDeploy factory for the Kallithea application.
 

	
 
    ``app_conf`` contains all the application-specific settings (those defined
 
    under ``[app:main]``.
 
    """
 
    logging.config.fileConfig(global_conf['__file__'])
 
    app = make_base_app(global_conf, full_stack=full_stack, **app_conf)
 
    return app
0 comments (0 inline, 0 general)