summaryrefslogtreecommitdiff
path: root/GroLUG
diff options
context:
space:
mode:
Diffstat (limited to 'GroLUG')
-rw-r--r--GroLUG/lib/GroLUG/C/Iscritti.pm2
-rw-r--r--GroLUG/lib/GroLUG/LogAppender.pm10
-rw-r--r--GroLUG/logger.conf7
-rw-r--r--GroLUG/sql/crea-tabelle.sql9
4 files changed, 28 insertions, 0 deletions
diff --git a/GroLUG/lib/GroLUG/C/Iscritti.pm b/GroLUG/lib/GroLUG/C/Iscritti.pm
index 61ac283..ee6ee0c 100644
--- a/GroLUG/lib/GroLUG/C/Iscritti.pm
+++ b/GroLUG/lib/GroLUG/C/Iscritti.pm
@@ -25,6 +25,8 @@ sub index :Private {
sub iscritto :Global {
my ($self,$c,$id)=@_;
+ $c->log->info($c->user->id,"scheda iscritto $id");
+
$c->stash->{iscritto}=GroLUG::M::DB->resultset('Iscritto')->find($id);
$c->stash->{template}='scheda-iscritto.tt2';
diff --git a/GroLUG/lib/GroLUG/LogAppender.pm b/GroLUG/lib/GroLUG/LogAppender.pm
new file mode 100644
index 0000000..81723ef
--- /dev/null
+++ b/GroLUG/lib/GroLUG/LogAppender.pm
@@ -0,0 +1,10 @@
+package GroLUG::LogAppender;
+use base 'Log::Log4perl::Appender::DBI';
+
+sub _init {
+ my ($self)=@_;
+
+ $self->{dbh}=GroLUG::M::DB->storage->dbh;
+}
+
+1;
diff --git a/GroLUG/logger.conf b/GroLUG/logger.conf
index 4b208a0..2852b05 100644
--- a/GroLUG/logger.conf
+++ b/GroLUG/logger.conf
@@ -1,7 +1,14 @@
log4perl.rootLogger = DEBUG, ConsoleAppender
+log4perl.logger.GroLUG.C.Iscritti = INFO, DBIAppender
log4perl.appender.ConsoleAppender = Log::Log4perl::Appender::Screen
log4perl.appender.ConsoleAppender.stderr = 1
log4perl.appender.ConsoleAppender.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.ConsoleAppender.layout.ConversionPattern =[%d] [catalyst] [%p] %m%n
+log4perl.appender.DBIAppender = GroLUG::LogAppender
+log4perl.appender.DBIAppender.sql = insert into log(loglevel,username,message) values (?,?,?)
+log4perl.appender.DBIAppender.params.1=%p
+log4perl.appender.DBIAppender.layout=Log::Log4perl::Layout::NoopLayout
+log4perl.appender.DBIAppender.warp_message=0
+log4perl.appender.DBIAppender.usePreparedStmt=1
diff --git a/GroLUG/sql/crea-tabelle.sql b/GroLUG/sql/crea-tabelle.sql
index 802c95a..4518948 100644
--- a/GroLUG/sql/crea-tabelle.sql
+++ b/GroLUG/sql/crea-tabelle.sql
@@ -1,6 +1,7 @@
drop table pagamenti;
drop table iscritti;
drop table sessioni;
+drop table log;
create table sessioni (
id char(72) primary key,
@@ -8,6 +9,14 @@ create table sessioni (
expires int
);
+create table log (
+ id serial primary key,
+ time timestamp default now(),
+ loglevel varchar(255),
+ username varchar(255),
+ message text
+);
+
create table iscritti (
id serial primary key,
nome varchar(255) not null,