diff --git a/eccs2.py b/eccs2.py
index 60ea3d88c758e2513c1676c41c9148f3498fda9f..d8a08bd26214008469cfe8458e89bc72e071a302 100755
--- a/eccs2.py
+++ b/eccs2.py
@@ -47,7 +47,7 @@ def getIdPs():
    return idp_list
 
 
-def checkIdP(driver,sp,idp):
+def checkIdP(driver,sp,idp,logger):
    import re
 
    # Apro la URL contenente il Discovery Service, inserisco l'idp e vado alla pagina di login
@@ -61,7 +61,7 @@ def checkIdP(driver,sp,idp):
    except NoSuchElementException as e:
      pass
    except TimeoutException as e:
-     logging.info("%s;%s;TIMEOUT" % (idp,sp))
+     logger.info("%s;%s;TIMEOUT" % (idp,sp))
      return "TIMEOUT"
 
    pattern_metadata = "Unable.to.locate(\sissuer.in|).metadata(\sfor|)|no.metadata.found|profile.is.not.configured.for.relying.party|Cannot.locate.entity|fail.to.load.unknown.provider|does.not.recognise.the.service|unable.to.load.provider|Nous.n'avons.pas.pu.(charg|charger).le.fournisseur.de service|Metadata.not.found|application.you.have.accessed.is.not.registered.for.use.with.this.service|Message.did.not.meet.security.requirements"
@@ -74,13 +74,13 @@ def checkIdP(driver,sp,idp):
    password_found = re.search(pattern_password,driver.page_source, re.I)
 
    if(metadata_not_found):
-      logging.info("%s;%s;No-eduGAIN-Metadata" % (idp,sp))
+      logger.info("%s;%s;No-eduGAIN-Metadata" % (idp,sp))
       return "No-eduGAIN-Metadata"
    elif not username_found and not password_found:
-      logging.info("%s;%s;Invalid-Form" % (idp,sp))
+      logger.info("%s;%s;Invalid-Form" % (idp,sp))
       return "Invalid Form"
    else:
-      logging.info("%s;%s;OK" % (idp,sp))
+      logger.info("%s;%s;OK" % (idp,sp))
       return "OK"
 
 def setup():
@@ -97,13 +97,39 @@ def setup():
 
    return driver
 
+# Use logger to produce files consumed by ECCS-2
+def getLogger(filename,log_level="DEBUG",path="./"):
 
-if __name__=="__main__":
+    logger = logging.getLogger(filename)
+    ch = logging.FileHandler(path+filename,'w','utf-8')
+
+    if (log_level == "DEBUG"):
+       logger.setLevel(logging.DEBUG)
+       ch.setLevel(logging.DEBUG)
+    elif (log_level == "INFO"):
+       logger.setLevel(logging.INFO)
+       ch.setLevel(logging.INFO)
+    elif (log_level == "WARN"):
+       logger.setLevel(logging.WARN)
+       ch.setLevel(logging.WARN)
+    elif (log_level == "ERROR"):
+       logger.setLevel(logging.ERROR)
+       ch.setLevel(logging.ERROR)
+    elif (log_level == "CRITICAL"):
+       logger.setLevel(logging.CRITICAL)
+       ch.setLevel(logging.CRITICAL)
+
+    formatter = logging.Formatter('%(message)s')
+    ch.setFormatter(formatter)
+    logger.addHandler(ch)
 
-   import os
-   os.remove("eccs2.log")
+    return logger
+
+
+if __name__=="__main__":
 
-   logging.basicConfig(format='%(message)s',filename='eccs2.log',level=logging.INFO)
+   eccs2log = getLogger("logs/eccs2.log","INFO")
+   eccs2checks = getLogger("logs/eccs2checks.log","INFO")
 
    driver = setup()
 
@@ -122,12 +148,12 @@ if __name__=="__main__":
    for idp in listIdPs:
       result = []
       for sp in sps:
-         result.append(checkIdP(driver,sp,idp))
+         result.append(checkIdP(driver,sp,idp,eccs2checks))
 
       # se tutti e 2 i check sono andati bene, allora l'IdP รจ OK, altrimenti no.
       if (result[0] == result[1] == "OK"):
-         print("IdP '%s' results into: OK" % (idp))
+         eccs2log.info("IdP '%s' results into: OK" % (idp))
       else:
-         print("IdP '%s' results into: NOT OK" % (idp))
+         eccs2log.info("IdP '%s' results into: NOT OK" % (idp))
 
    driver.close()
diff --git a/logs/.gitignore b/logs/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..5e7d2734cfc60289debf74293817c0a8f572ff32
--- /dev/null
+++ b/logs/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore