(RADIATOR) Logging from Hooks

Hugh Irvine hugh at open.com.au
Thu Aug 16 06:09:28 CDT 2007


Hello Chris -

Answers below...


On 16 Aug 2007, at 19:46, Chris Cronje - MWEB wrote:

> Hi There,
>
>
>
> I have a question about logging messages from inside hooks.
>
>
OK

> If for example I have a logging config that looks like this:
>
>>
> LogFile         %L/logfile
>
>
>
> <Handler xxx>
>
>   Identifier TEST
>
>   PostAuthHook file:"/etc/radiator/PostAuthHook.pl"
>
>
>
>   <Log FILE>
>
>      Identifier TESTLOG
>
>      Filename %L/test_logfile
>
>    </Log>
>
>>
>
>
> Usually we use the following method to log stuff from within hooks:
>
>
>
> &main::log($main::LOG_DEBUG,"This is a log message");
>
>
>
> But the above message only logs to the default logfile.
>
>
>
> Is there a way that I can log messages into test_logfile from  
> within a hook, instead of just the default logfile ?

Typically you would use the appropriate find() routine to find the  
logger you want, then log to it instead of using &main::log().

Something like this (not tested but you should get the idea):


	......

	my $logger = &Configurable::find('Log', 'TESTLOG');

	$logger->log(....);

	......


> One other question – is there documentation somewhere of all the  
> functions that are available to use from within hooks ?
>
>

The best place to look is the Radiator source code. You should start  
with "radiusd", then "Radius/Client.pm", then "Radius/Handler.pm",  
then "Radius/AuthGeneric.pm".

You can then read other modules as you feel the urge. For the above,  
see "Radius/Configurable.pm" and "Radius/LogGeneric.pm".

Of course you can always ask questions too.

regards

Hugh

> Thanks
>
>
>
> Chris
>
> MWEB brings you the freedom of Wireless 3G/HSDPA technology for  
> only R199p/m
> for the first 6 months and thereafter R249p/m on 500MB package.  
> (T&C’s apply)
>
> To join, call 08600 32000 now or click here to find out more
>
>
> MWEB :-)  JUST LIKE THAT
>
>



NB:

Have you read the reference manual ("doc/ref.html")?
Have you searched the mailing list archive (www.open.com.au/archives/ 
radiator)?
Have you had a quick look on Google (www.google.com)?
Have you included a copy of your configuration file (no secrets),
together with a trace 4 debug showing what is happening?
Have you checked the RadiusExpert wiki:
http://www.open.com.au/wiki/index.php/Main_Page

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows, MacOS X.
Includes support for reliable RADIUS transport (RadSec),
and DIAMETER translation agent.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
-
CATool: Private Certificate Authority for Unix and Unix-like systems.



--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list