erlang - Best way to log access to web pages -


one of website using nitrogen cowboy server. log every access web pages apache access.log. best way ?

each underlying webserver differently (or not @ all) - simple_bridge not yet have abstracted.

so in case of cowboy, you'll have rig yourself.

if you're using newer build of nitrogen (if have file site/src/nitrogen_main_handler.erl), can edit file manually log yourself. example, using erlang's error handler, add simple like:

log_request() ->     error_logger:info_msg("~p: [~p]: ~p", [{date(), time()}, wf:peer_ip(), wf:url()]).  run() ->     handlers(),     log_request(), %% <--- insert before wf_core:run()     wf_core:run(). 

then whatever happens log can handled configuring error_logger write disk (http://erldocs.com/17.0/kernel/error_logger.html?i=13&search=error_logger#logfile/1)

if use older nitrogen (which have site/src/nitrogen_cowboy.erl), edit file, once again before wf_core:run() call.

alternatively, hooks option cowboy work well. i've not worked them, you're on own there :)


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -