Index: src/mapservice/codegen/code_generator
===================================================================
--- src/mapservice/codegen/code_generator	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/codegen/code_generator	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -4,4 +4,5 @@
 SRC_GEN="${DIR}/../src-gen"
 TARGET="${SRC_GEN}/openapi_server/"
+CELERY_WORKER_SCRIPT="${SRC_GEN}/celery_worker"
 
 echo "Cleaning directory"
@@ -11,7 +12,10 @@
 mkdir -p "${TARGET}"
 cd "${TARGET}"
-if [ ! -L server_impl ]; then
-	ln -s ../../src/server_impl/
-fi
+#if [ ! -L server_impl ]; then
+#	ln -s ../../src/server_impl/
+#fi
+mkdir -p server_impl
+cp -a ../../src/server_impl/* server_impl/
+#mv server_impl/CeleryWorker.py ./
 
 #echo "Copying static files"
@@ -27,4 +31,5 @@
 mkdir -p templates
 cp -a ../../templates/* templates/
+ln -s ../templates server_impl/templates
 
 echo "Generating backend and client API code"
@@ -37,5 +42,20 @@
 
 
+echo "#!/bin/bash" > "${CELERY_WORKER_SCRIPT}"
+echo 'export FLASK_ENV="development"' >> "${CELERY_WORKER_SCRIPT}"
+echo "celery -A openapi_server.server_impl.CeleryWorker:celery worker -l info -E" >> "${CELERY_WORKER_SCRIPT}"
+chmod +x "${CELERY_WORKER_SCRIPT}"
+
 cd src-gen/
 tox > /tmp/openapi_tox.log
+echo "###########################"
+echo "#"
+echo "# Do not forget to start the celery worker with"
+echo "#   1. start RabbitMQ broker with"
+echo "#       sudo service rabbitmq-server start"
+echo "#   2. start celery worker with"
+echo "#       cd ${SRC_GEN} && ${CELERY_WORKER_SCRIPT}"
+echo "#"
+echo "###########################"
+export FLASK_ENV="development"
 python3 -m openapi_server
Index: src/mapservice/codegen/templates/__init__.mustache
===================================================================
--- src/mapservice/codegen/templates/__init__.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/codegen/templates/__init__.mustache	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -1,8 +1,10 @@
-import connexion
-from flask_cors import CORS
-from flask_mail import Mail
+#import connexion
+#from flask_cors import CORS
+#from flask_mail import Mail
+#from celery import Celery
 
-app = connexion.App(__name__, specification_dir='./openapi/')
-application = app.app
-CORS(application)
-mail = Mail()
+#app = connexion.App(__name__, specification_dir='./openapi/')
+#application = app.app
+#CORS(application)
+#mail = Mail()
+#celery = Celery(application.name)
Index: src/mapservice/codegen/templates/__main__.mustache
===================================================================
--- src/mapservice/codegen/templates/__main__.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/codegen/templates/__main__.mustache	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -6,38 +6,9 @@
 {{/supportPython2}}
 
-import flask
-from sqlalchemy import event
+from {{packageName}}.server_impl import app, application, mail, celery, setup_app
 
-from {{packageName}} import encoder, app, application, mail
-from {{packageName}}.server_impl.database.Model import db, User, ApiKey, db_setup, db_test_setup
-from {{packageName}}.server_impl.ValidatorWorkaround import ValidatorWorkaround
-
-@application.before_first_request
-def create_database():
-	@event.listens_for(db.engine, "connect")
-	def load_spatialite(dbapi_conn, connection_record):
-		if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
-			# From https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html
-			dbapi_conn.enable_load_extension(True)
-			dbapi_conn.load_extension('/usr/local/lib64/mod_spatialite')
-
-	if flask.current_app.config['CREATE_TEST_DATABASE'] == True:
-		db_test_setup()
-	else:
-		db_setup()
-
-@application.route("/mapservice/")
-def index():
-	return render_template('index.html')
-	
 def main():
-	application.json_encoder = encoder.JSONEncoder
-	app.add_api('openapi.yaml', arguments={'title': '{{appName}}'}, validate_responses=True, strict_validation=True, validator_map={'response': ValidatorWorkaround})
-	application.config.from_object('{{packageName}}.server_impl.Config.DevelopmentConfig')
-
-	db.init_app(application)
-	mail.init_app(application)
-
-	app.run(port={{serverPort}})
+	setup_app('{{appName}}', 'DevelopmentConfig')
+	app.run(host=application.config.get("HOST", "localhost"), port=application.config.get("PORT", {{serverPort}}))
 
 if __name__ == '__main__':
Index: src/mapservice/codegen/templates/requirements.mustache
===================================================================
--- src/mapservice/codegen/templates/requirements.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/codegen/templates/requirements.mustache	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -13,3 +13,4 @@
 sqlalchemy_utc
 sqlalchemy-utils
+celery
 gnuboat_common
Index: src/mapservice/openapi.yaml
===================================================================
--- src/mapservice/openapi.yaml	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/openapi.yaml	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -617,16 +617,10 @@
           description: Logs uploaded
           content:
-            application/geo+json:
-              schema:
-                $ref: '#/components/schemas/LogGeoJson'
+            application/json:
+              schema:
+                $ref: '#/components/schemas/LogMetaData'
               examples:
                 Log:
-                  $ref: '#/components/examples/LogGeoJson'
-            application/json:
-              schema:
-                $ref: '#/components/schemas/Log'
-              examples:
-                Log:
-                  $ref: '#/components/examples/Log'
+                  $ref: '#/components/examples/LogMetaData'
         '400':
           $ref: '#/components/responses/BadRequest'
Index: src/mapservice/src/server_impl/CeleryWorker.py
===================================================================
--- src/mapservice/src/server_impl/CeleryWorker.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
+++ src/mapservice/src/server_impl/CeleryWorker.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -0,0 +1,52 @@
+'''
+    Copyright (C) 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+from celery import Celery
+import flask
+from sqlalchemy import event
+
+from . import config, app, application, celery, setup_app
+from .database.Model import db
+from .tasks import tasks
+
+# see https://flask.palletsprojects.com/en/1.1.x/patterns/celery/
+def setup_celery(flask_app, celery_app):
+	celery_app.conf.update(flask_app.config)
+	TaskBase = celery_app.Task
+
+	class ContextTask(TaskBase):
+		abstract = True
+
+		def __call__(self, *args, **kwargs):
+			with flask_app.app_context():
+				@event.listens_for(db.engine, "connect")
+				def load_spatialite(dbapi_conn, connection_record):
+					if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
+						# From https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html
+						dbapi_conn.enable_load_extension(True)
+						dbapi_conn.load_extension('/usr/local/lib64/mod_spatialite')
+				
+				return TaskBase.__call__(self, *args, **kwargs)
+	
+	celery_app.Task = ContextTask
+	
+	return celery_app
+
+setup_app('GNUBoat Celery Worker', 'DevelopmentConfig')
+setup_celery(application, celery)
+
+print(application.root_path)
+print(application.instance_path)
Index: src/mapservice/src/server_impl/Config.py
===================================================================
--- src/mapservice/src/server_impl/Config.py	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/src/server_impl/Config.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -25,4 +25,6 @@
 	MAIL_DEFAULT_SENDER = 'GNUBoat Mapservice <gnuboat@engsas.de>'
 	MAPSERVICE_WEBCLIENT = '/'
+	CELERY_BROKER_URL = 'pyamqp://guest@localhost//'
+	CELERY_IMPORTS = ("openapi_server.server_impl.tasks")
 
 class ProductionConfig(Config):
@@ -33,4 +35,7 @@
 	CREATE_TEST_DATABASE = True
 	MAPSERVICE_WEBCLIENT = 'http://localhost:8081'
+	#SERVER_NAME = 'gnuboat-mapservice:8080'
+	HOST = 'localhost'
+	SERVER_NAME = 'localhost:8080'
 
 class TestingConfig(Config):
Index: src/mapservice/src/server_impl/__init__.py
===================================================================
--- src/mapservice/src/server_impl/__init__.py	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/src/server_impl/__init__.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -0,0 +1,70 @@
+'''
+    Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import connexion
+import flask
+from flask_cors import CORS
+from flask_mail import Mail
+from sqlalchemy import event
+from celery import Celery
+from werkzeug.utils import import_string
+import os
+
+from .. import encoder
+from .database.Model import db, User, ApiKey, db_setup, db_test_setup
+from .ValidatorWorkaround import ValidatorWorkaround
+
+# determine requested configuration
+if 'FLASK_ENV' in os.environ and os.environ['FLASK_ENV']:
+	config_name = os.environ['FLASK_ENV'].title()
+else:
+	config_name = 'Production'
+config_name = 'openapi_server.server_impl.Config.{}Config'.format(config_name)
+config = import_string(config_name)
+
+app = connexion.App(__name__, specification_dir='../openapi/')
+application = app.app
+CORS(application)
+mail = Mail()
+celery = Celery(__name__, broker=config.CELERY_BROKER_URL)
+
+@application.before_first_request
+def create_database():
+	@event.listens_for(db.engine, "connect")
+	def load_spatialite(dbapi_conn, connection_record):
+		if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
+			# From https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html
+			dbapi_conn.enable_load_extension(True)
+			dbapi_conn.load_extension('/usr/local/lib64/mod_spatialite')
+
+	if flask.current_app.config['CREATE_TEST_DATABASE'] == True:
+		db_test_setup()
+	else:
+		db_setup()
+
+@application.route("/mapservice/")
+def index():
+	return render_template('index.html')
+
+def setup_app(app_name, config_name="Config"):
+	application.json_encoder = encoder.JSONEncoder
+	app.add_api('openapi.yaml', arguments={'title': app_name}, validate_responses=True, strict_validation=True, validator_map={'response': ValidatorWorkaround})
+	application.config.from_object(config)
+
+	db.init_app(application)
+	mail.init_app(application)
+	celery.config_from_object(config)
Index: src/mapservice/src/server_impl/controllers/LogsController.py
===================================================================
--- src/mapservice/src/server_impl/controllers/LogsController.py	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/src/server_impl/controllers/LogsController.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -17,42 +17,7 @@
 import connexion
 
-from gnuboat_common.datahandler import loghandler
-
 from ..database.Model import User, Log, LogEntry, Water, Device, Gauge, ProcessingStatus, Queue, db
 from ..HttpErrors import MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
-
-class LogEntryCallback:
-	def __init__(self):
-		self._entries = []
-		self._start = None
-		self._end = None
-
-	def valid(self):
-		if self._start is None:
-			return False
-		if self._end is None:
-			return False
-		if len(self._entries) < 1:
-			return False
-		return True
-
-	def start(self):
-		return self._start
-	
-	def end(self):
-		return self._end
-
-	def entries(self):
-		return self._entries
-
-	def callback(self, dataset):
-		self._entries.append(dataset)
-        
-		# check / set start and end date
-		entry_datetime = dataset.datetime_object()
-		if self.start() is None or entry_datetime < self.start():
-			self._start = entry_datetime
-		if self.end() is None or self.end() < entry_datetime:
-			self._end = entry_datetime
+from ..tasks.tasks import log_parse
 
 def logs_get(submitter=None, order_by=None, offset=None, limit=None):
@@ -129,7 +94,7 @@
 		raise MapserviceBadRequest(detail='No log data')
 	
-	processing_state = ProcessingStatus.query.filter_by(label='Queued').all()
+	processing_state = ProcessingStatus.query.filter_by(label='Queued for Parsing').all()
 	if len(processing_state) != 1:
-		raise MapserviceBadRequest(detail='Processing status Queued not found database')
+		raise MapserviceBadRequest(detail='Processing status Queued for Parsing not found database')
 	processing_state = processing_state[0]
 	
@@ -142,35 +107,15 @@
 	if LogEntry.query.filter_by(log=log).count() > 0:
 		raise MapserviceBadRequest(detail='Log {} has already log entries. Aborting'.format(log_id))
-	
-	# updating start / end of Log according to log file
-	body = body.decode()
-	log_callback = LogEntryCallback()
-	log_handler = loghandler.LogHandler()
-	result = log_handler.gnuboat_read(body.splitlines(), log_callback.callback, False, False)
-	if not result.success():
-		raise MapserviceBadRequest(detail='Could not parse logfile: {}'.format('\n'.join(result.errors())))
-	if not log_callback.valid():
-		if len(log_callback.entries()) < 1:
-			raise MapserviceBadRequest(detail='No entry in logfile')
-		raise MapserviceBadRequest(detail='No start or end date found')
-	
-	for entry in log_callback.entries():
-		if entry.water_depth() is not None:
-			location = entry.location()
-			log_entry = LogEntry(log=log, datetime=entry.datetime_object(), location='SRID=4326;POINT({} {})'.format(location.longitude, location.latitude), water_depth=entry.water_depth())
-			db.session.add(log_entry)
-	
+
+	# Add Log to Queued table and change the processing state of Log
 	queue = Queue(log=log)
 	db.session.add(queue)
-	
-	log.start = log_callback.start()
-	log.end = log_callback.end()
 	log.processingstatus = processing_state
-		
 	db.session.commit()
 	
-	if connexion.request.headers['Accept'] == "application/geo+json":
-		return log.to_geojson(), 200, {'Content-Type': 'application/geo+json; charset=utf-8'}
-	return log.log()
+	# request log parsing
+	log_parse.delay(log.id, body.decode())
+	
+	return log.meta_data()
 
 def logs_log_delete(id):
Index: src/mapservice/src/server_impl/controllers/UsersController.py
===================================================================
--- src/mapservice/src/server_impl/controllers/UsersController.py	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/src/server_impl/controllers/UsersController.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -24,5 +24,5 @@
 from flask_mail import Message
 
-from openapi_server import mail
+from .. import mail
 from ..database.Model import User, ApiKey, db
 from ..HttpErrors import MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
@@ -82,13 +82,13 @@
 	if user_creation is None:
 		raise MapserviceBadRequest(detail='No data specified')
-	if user_creation.username is None or user_creation.username == "":
+	if user_creation.username is None or not user_creation.username:
 		raise MapserviceBadRequest(detail='No username given')
-	if user_creation.password is None or user_creation.password == "":
+	if user_creation.password is None or not user_creation.password:
 		raise MapserviceBadRequest(detail='No password given')
-	if user_creation.first_name is None or user_creation.first_name == "":
+	if user_creation.first_name is None or not user_creation.first_name:
 		raise MapserviceBadRequest(detail='No first name given')
-	if user_creation.last_name is None or user_creation.last_name == "":
+	if user_creation.last_name is None or not user_creation.last_name:
 		raise MapserviceBadRequest(detail='No last name given')
-	if user_creation.email is None or user_creation.email == "":
+	if user_creation.email is None or not user_creation.email:
 		raise MapserviceBadRequest(detail='No email given')
 	if not mail_regex.match(user_creation.email):
Index: src/mapservice/src/server_impl/database/Model.py
===================================================================
--- src/mapservice/src/server_impl/database/Model.py	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/src/server_impl/database/Model.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -22,5 +22,5 @@
 from geoalchemy2.shape import to_shape
 from sqlalchemy_utc import UtcDateTime
-from sqlalchemy_utils import create_view
+from sqlalchemy_utils import create_view, database_exists, create_database
 from shapely import wkb
 import hashlib
@@ -218,5 +218,5 @@
 	@staticmethod
 	def insert_states():
-		states = [ 'Undefined', 'Queued', 'Processing', 'Processed', 'To Old' ]
+		states = [ 'Undefined', 'Queued for Parsing', 'Parsing', 'Queued for Processing', 'Processing', 'Deployed', 'To Old', 'Error' ]
 		changed = False
 		for state in states:
@@ -366,10 +366,12 @@
 
 def db_setup():
-	if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
-		print("Initiate spatial meta data for Spatialite...")
-		db.engine.execute(select([func.InitSpatialMetaData()]))
-		print("...Finished")
-	db.create_all()
-	ProcessingStatus.insert_states()
+	if not database_exists(db.engine.url):
+		create_database(db.engine.url)
+		if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
+			print("Initiate spatial meta data for Spatialite...")
+			db.engine.execute(select([func.InitSpatialMetaData()]))
+			print("...Finished")
+		db.create_all()
+		ProcessingStatus.insert_states()
 
 def db_test_setup():
@@ -383,6 +385,7 @@
 			test_user_john = query[0]
 		else:
-			test_user_john = User.factory('john', 'testpass2', 'john@example.org', license_accepted=True)
+			test_user_john = User.factory('john', 'testpass2', 'john@example.org')
 			test_user_john.activation_code = 'dac9630aec642a428cd73f4be0a03569'
+			test_user_john.license_accepted = True
 			db.session.add(test_user_john)
 			db.session.commit()
@@ -393,7 +396,8 @@
 			test_user_jane = query[0]
 		else:
-			test_user_jane = User.factory('jane', 'testpass', 'jane@example.org', license_accepted=True)
+			test_user_jane = User.factory('jane', 'testpass', 'jane@example.org')
 			test_user_jane.activated = True
 			test_user_jane.first_name = 'Jane'
+			test_user_jane.license_accepted = True
 			db.session.add(test_user_jane)
 			db.session.commit()
Index: src/mapservice/src/server_impl/tasks/__init__.py
===================================================================
--- src/mapservice/src/server_impl/tasks/__init__.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
+++ src/mapservice/src/server_impl/tasks/__init__.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -0,0 +1,17 @@
+'''
+    Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+from .tasks import log_process
Index: src/mapservice/src/server_impl/tasks/tasks.py
===================================================================
--- src/mapservice/src/server_impl/tasks/tasks.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
+++ src/mapservice/src/server_impl/tasks/tasks.py	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -0,0 +1,178 @@
+'''
+    Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+import celery
+from flask import render_template, url_for
+import datetime
+from flask_mail import Message
+
+from gnuboat_common.datahandler import loghandler
+
+from .. import mail, celery as celery_app
+from ..database.Model import User, Log, LogEntry, Water, ProcessingStatus, Queue, db
+
+class LogEntryCallback:
+	def __init__(self):
+		self._entries = []
+		self._start = None
+		self._end = None
+
+	def valid(self):
+		if self._start is None:
+			return False
+		if self._end is None:
+			return False
+		if len(self._entries) < 1:
+			return False
+		return True
+
+	def start(self):
+		return self._start
+	
+	def end(self):
+		return self._end
+
+	def entries(self):
+		return self._entries
+
+	def callback(self, dataset):
+		self._entries.append(dataset)
+        
+		# check / set start and end date
+		entry_datetime = dataset.datetime_object()
+		if self.start() is None or entry_datetime < self.start():
+			self._start = entry_datetime
+		if self.end() is None or self.end() < entry_datetime:
+			self._end = entry_datetime
+
+def queue_delete(log):
+	if not queue.delete():
+		app.logger.error('Could not delete queue for log {}'.format(log.id))
+	db.session.commit()
+
+def update_log_state(log, status):
+	processing_state = ProcessingStatus.query.filter_by(label=status).all()
+	if len(processing_state) != 1:
+		app.logger.error('Processing status {} not found database'.format(status))
+		return
+	processing_state = processing_state[0]
+	log.processingstatus = processing_state
+	db.session.add(log)
+	db.session.commit()
+	
+def cleanup_error(log):
+	update_log_state(log, 'Error')
+	queue_delete(log)
+
+@celery_app.task
+def log_parse(log_id, log_content):
+	"""Background task to parse new logs"""
+	
+	log = Log.query.filter_by(id=log_id).all()
+	if len(log) != 1:
+		app.logger.warn("Could not find log {}".format(log_id))
+		return False
+	log = log[0]
+	
+	update_log_state(log, 'Parsing')
+	
+	water_link = '{}'.format(url_for('/mapservice/v1.openapi_server_controllers_waters_controller_waters_get_by_id', id=log.water.id, _external=True))
+	
+	queue = Queue.query.filter_by(log_id=log.id).all()
+	if len(queue) != 1:
+		message = Message("Error parsing log file", recipients=[log.submitter.email])
+		message.html = render_template('log_parsing_error.html',
+			first_name=log.submitter.first_name,
+			queue_date=queue_date.isoformat('T'),
+			water_link=water_link,
+			water_name=log.water.name,
+			errors="No queue for log file")
+		mail.send(message)
+		
+		app.logger.warn("Could not find queue for log {}".format(log.id))
+		
+		cleanup_error(log)
+		
+		return False
+	queue = queue[0]
+	queue_date = queue.datetime
+	
+	log_callback = LogEntryCallback()
+	log_handler = loghandler.LogHandler()
+	result = log_handler.gnuboat_read(log_content.splitlines(), log_callback.callback, False, False)
+	if not result.success():
+		message = Message("Error parsing log file", recipients=[log.submitter.email])
+		message.html = render_template('log_parsing_error.html',
+			first_name=log.submitter.first_name,
+			queue_date=queue_date.isoformat('T'),
+			water_link=water_link,
+			water_name=log.water.name,
+			errors=result.errors())
+		mail.send(message)
+		
+		app.logger.info('Could not parse logfile {}: {}'.format(log.id, '\n'.join(result.errors())))
+		
+		cleanup_error(log)
+		
+		return False
+	if not log_callback.valid():
+		message = Message("Error parsing log file", recipients=[log.submitter.email])
+		message.html = render_template('log_parsing_error.html',
+			first_name=log.submitter.first_name,
+			queue_date=queue_date.isoformat('T'),
+			water_link=water_link,
+			water_name=log.water.name,
+			errors="Log has no entries")
+		mail.send(message)
+		
+		app.logger.info('Could not parse logfile {}: {}'.format(log.id, 'Log has no entries'))
+		
+		cleanup_error(log)
+		
+		return True
+	
+	for entry in log_callback.entries():
+		if entry.water_depth() is not None:
+			location = entry.location()
+			log_entry = LogEntry(log=log, datetime=entry.datetime_object(), location='SRID=4326;POINT({} {})'.format(location.longitude, location.latitude), water_depth=entry.water_depth())
+			db.session.add(log_entry)
+	
+	# set queue for processing
+	queue.datetime = datetime.datetime.now(datetime.timezone.utc)
+	db.session.add(queue)
+	
+	# update state and start / end time of the log, gained from log parsing
+	log.start = log_callback.start()
+	log.end = log_callback.end()
+	update_log_state(log, 'Queued for Processing')
+	
+	message = Message("Error parsing log file", recipients=[log.submitter.email])
+	message.html = render_template('log_parsed.html',
+		first_name=log.submitter.first_name,
+		queue_date=queue_date.isoformat('T'),
+		water_link=water_link,
+		water_name=log.water.name)
+	mail.send(message)
+	
+	# request processing
+	log_process.delay(log.id)
+	
+	return True
+
+@celery_app.task
+def log_process(log_id):
+	"""Background task to process new logs"""
+	return True
Index: src/mapservice/templates/activation_mail.html
===================================================================
--- src/mapservice/templates/activation_mail.html	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/templates/activation_mail.html	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -2,4 +2,3 @@
 <p>thank you for supporting the project with your own measurings. All your measurings are handled under the <a href="https://www.opendatacommons.org/licenses/odbl/summary/index.html" target="_blank">Open Data Commons Open Database License (ODbL)</a>, which you have already accepted. It is the same license as OpenStreetmap uses.</p>
 <p>To activate your GNUBoat account, you need ot visit <a href="{{activation_url}}">{{activation_url}}</a>.</p>
-<p>Kind regards,<br>
-Your GNUBOat team</p>
+<p>Kind regards,<br>Your GNUBoat team</p>
Index: src/mapservice/templates/log_parsed.html
===================================================================
--- src/mapservice/templates/log_parsed.html	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
+++ src/mapservice/templates/log_parsed.html	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -0,0 +1,3 @@
+<p>Hello {{first_name}},</p>
+<p>we successfully parsed your uploaded log file queued at {{queue_date}} for water <a href="{{water_link}}">{{water_name}}</a>. Now we are going to process it and deploy the new map afterwards.</p>
+<p>Thank you for activly contributing to GNUBoat,<br>Your GNUBoat team</p>
Index: src/mapservice/templates/log_parsing_error.html
===================================================================
--- src/mapservice/templates/log_parsing_error.html	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
+++ src/mapservice/templates/log_parsing_error.html	(revision a88607b183ce311a18e1c7fcbaa80e52cfd4c12a)
@@ -0,0 +1,8 @@
+<p>Hello {{first_name}},</p>
+<p>we could not parse your uploaded log file queued at {{queue_date}} for water <a href="{{water_link}}">{{water_name}}</a>. The following errors occured:</p>
+<ul>
+ {% for error in errors %}
+ <li>{{ error }}</li>
+ {% endfor %}
+</ul>
+<p>Kind regards,<br>Your GNUBoat team</p>
