#this is a fragment from httpd.conf to show an example 
#(and I hope the strengths too....)

#load the dblog_module with mod_so
#compiling in is not possible, but if you succeded tell me!
LoadModule dblog_module /home/developer/ ... /mod_dblog.so

#Load any other files required by your loging modules
LoadFile /usr/local/postgres7.1.2/lib/libecpg.so
LoadFile /usr/local/postgres7.1.2/lib/libpq.so

#Tell mod_mylog to load the loging modules
LoadLogModule pgemb_mod /home/developer/ ... /embededsql/embsql.so
LoadLogModule pqloger /home/developer/ ... /postgres/pqloger.so

#now let`s see the per directory configuration

#say nothing for the htdocs directory, so it won`t be loged.


<Directory /usr/local/apache/htdocs/manual/>
    #set database connection string for the directory 'manual'
    LogServer db=www; host=otherhost; pwd=haliho; user=www;
    #set the loging module for the directory
    LogType pgemb_mod
</Directory>

#the other directory can be configured other way, and the configuration 
#directives can override each others of course.
<Directory /usr/local/apache/htdocs/hello>
    LogServer db=www; host=localhost; pwd=pwd; user=wwwuser; port=5432; mas=mi;
    LogType pqloger
</Directory>

#The configuration directives implemented now:

# LoadLogModule <symbol name> <dso>
#
#	Loads the dynamic shared object named by the second param and 
#	re solves the symbol nameb by the first param. 
#	If you want to use any RDMBS specific module, you must first load
#	it with this directive.

# LogServer <connect string>
#
#	Sets the connection string. It uses it`s own format for describing the
#	the connection. The connect string is a list of key-value pairs in 
#	format "key=value;" (the end of the key-name is at the '=' the end 
#	of the value is at ';')
#	The key is one of the following (see dblogi.h):
#		user, pwd, host, port, db, socket, connect

# LogType <module name>
#
#	Sets the loging module for the directory

#-----------------------------------------------------------------------------

#This is implemented now, for the stable release, there should be some more 
#configuration directives:

# ConnectOnStart [On | Off]
#	
#	This will tell apache to connect to the database server on startup time
#	or only if requested.
#	I donno if it should be a per directory or a resource config directive.

#-----------------------------------------------------------------------------

#How failover SHOULD look like:
#(plans for the near future)

#POSSIBLE SITUATIONS:

#1. Let`s say you have two server (sql1 and sql2). You want to use
#sql2 only if sql1 is dead. 

#2. You have two sql servers. You have to write the log first to sql1 and then
#to sql2.
# subcases:
# 2.1 ignoring the failure of the first server.
# 2.2 only if the first loging succeeded.
# 2.3 only if the first loging failed.

#sql1 and sql2 can be diffenrent RDBMS too.

#loging the same request to multiple RDBMS require more configuration 
#directives.

#IDEA ONLY:
#The httpd.conf`s structure is not flexible enough. Let`s create an outside
#config file parsed by the central module. The configuration file looks 
#like a object-oriented programming language, it uses try-catch blocks.

#this could look like a python script:
#try:
#	AddLogServer mysql host=host1; db=www; user=nobody; pwd=hello;
#catch:
#	AddLogServer mysql host=host2; db=www; user=nobody; pwd=zdrastvujtye;

#(this script logs on host1, or if it failed host2)

#other possibilities:
#xml
#c++-style

