Skip to content

Commit

Permalink
""
Browse files Browse the repository at this point in the history
git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@35 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information
Claes Wikstrom committed Mar 4, 2002
1 parent e315955 commit 8104bc6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ebin/yaws.app
@@ -1,6 +1,6 @@
{application,yaws,
[{description,"yaws WWW server"},
{vsn,"0.26"},
{vsn,"0.28"},
{modules,[yaws, yaws_app, yaws_config, yaws_server, yaws_sup, yaws_api, yaws_log, yaws_ls, yaws_debug, yaws_compile]},
{registered, []},
{mod,{yaws_app,[]}},
Expand Down
6 changes: 4 additions & 2 deletions scripts/Install
Expand Up @@ -6,8 +6,10 @@ prefix=$1
erl=$2

. ../vsn.mk
y=yaws-${YAWS_VSN}

sh ./mangle ${prefix}/lib/yaws-${YAWS_VSN} ${erl} yaws.ss ${prefix}/bin/yaws

sh ./mangle ${prefix}/lib/yaws ${erl} yaws.ss ${prefix}/bin/yaws
install -d ${prefix}/lib/yaws/examples/ebin
install -d ${prefix}/lib/yaws/examples/include
chmod +x ${prefix}/bin/yaws
Expand All @@ -17,5 +19,5 @@ else
t=/etc/yaws.conf
fi

sh ./mangle ${prefix}/lib/yaws-${YAWS_VSN} ${erl} yaws.conf.template ${t}
sh ./mangle ${prefix}/lib/yaws ${erl} yaws.conf.template ${t}

14 changes: 11 additions & 3 deletions src/yaws_config.erl
Expand Up @@ -16,9 +16,16 @@

%% where to look for yaws.conf
paths() ->
[filename:join([os:getenv("HOME"), "yaws.conf"]),
"./yaws.conf",
"/etc/yaws.conf"].
case os:cmd("id -u") of
[$0 |_] -> %% root
["./yaws.conf",
"/etc/yaws.conf"];
_ -> %% developer
[filename:join([os:getenv("HOME"), "yaws.conf"]),
"./yaws.conf",
"/etc/yaws.conf"]
end.



%% load the config
Expand All @@ -31,6 +38,7 @@ load(false, Trace, Debug) ->
load({file, File}, Trace, Debug)
end;
load({file, File}, Trace, Debug) ->
yaws_log:infolog("Using config file ~s", [File]),
case file:open(File, [read]) of
{ok, FD} ->
GC = make_default_gconf(),
Expand Down
16 changes: 15 additions & 1 deletion src/yaws_log.erl
Expand Up @@ -40,6 +40,8 @@ accesslog(Ip, Req, Status, Length) ->
gen_server:cast(?MODULE, {access, Ip, Req, Status, Length}).
errlog(F, A) ->
gen_server:cast(?MODULE, {errlog, F, A}).
infolog(F, A) ->
gen_server:cast(?MODULE, {infolog, F, A}).
sync_errlog(F, A) ->
gen_server:call(?MODULE, {errlog, F, A}).
setdir(Dir) ->
Expand Down Expand Up @@ -77,12 +79,14 @@ init([]) ->
%%----------------------------------------------------------------------
handle_call({setdir, Dir}, From, State) when State#state.running == false ->
?Debug("setdir ~s~n~p", [Dir, State#state.ack]),
error_logger:logfile({open,filename:join([Dir, "error.log"])}),
error_logger:logfile({open,filename:join([Dir, "log"])}),
Alog = filename:join([Dir, "access"]),
case file:open(Alog, [write, raw, append]) of %% FIXME wrap log
{ok, Fd} ->
lists:foreach(fun({err, F, A}) ->
error_logger:format(F, A);
({info, F, A}) ->
error_logger:info_msg(F,A);
({access, Ip, Req, Status, Length}) ->
I = fmt_alog(State#state.now,
Ip, Req, Status,
Expand Down Expand Up @@ -129,6 +133,16 @@ handle_cast({errlog, F, A}, State) when State#state.running == true ->
{noreply, State};
handle_cast({errlog, F, A}, State) when State#state.running == false ->
{noreply, State#state{ack = [{err, F, A} | State#state.ack]}};


handle_cast({infolog, F, A}, State) when State#state.running == true ->
error_logger:info_report(F, A),
{noreply, State};
handle_cast({infolog, F, A}, State) when State#state.running == false ->
{noreply, State#state{ack = [{info, F, A} | State#state.ack]}};



handle_cast({access, Ip, Req, Status, Length}, State) ->
case State#state.running of
true ->
Expand Down
2 changes: 1 addition & 1 deletion vsn.mk
@@ -1 +1 @@
YAWS_VSN=0.27
YAWS_VSN=0.29

0 comments on commit 8104bc6

Please sign in to comment.