Repository: dynaconf/dynaconf

Issue:
[bug] Regression on config path-traversal
**Describe the bug**
Configuration is not read correctly for the parent directories

**To Reproduce**
Steps to reproduce the behavior:
```
 /tmp/test$ find .
.
./test2
./.env

/tmp/test$ ipython3 -c "from dynaconf import settings; print(settings.ENV_FOR_DYNACONF)"
testavalue1

/tmp/test$ cd test2
/tmp/test/test2$ ipython3 -c "from dynaconf import settings; print(settings.ENV_FOR_DYNACONF)"
DEVELOPMENT

/tmp/test/test2$ cat ../.env
ENV_FOR_DYNACONF=testavalue1
```


2. Having the following config files:

see above

3. Having the following app code:

see above

4. Executing under the following environment
conda
Python 3.7.3


**Expected behavior**

Reading the file from the parent directory iff  it does not exist in the current dir.

**Debug output**

<details>
<summary> Debug Output </summary>

```bash

export `DEBUG_LEVEL_FOR_DYNACONF=true` reproduce your problem and paste the output here

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-065bd64b7197> in <module>
----> 1 from dynaconf import settings; print(settings.ENV_FOR_DYNACONF)

~/miniconda3/envs/smr/lib/python3.7/site-packages/dynaconf/__init__.py in <module>
      1 # coding: utf-8
----> 2 from dynaconf.base import LazySettings
      3 from dynaconf.validator import Validator, ValidationError
      4 from dynaconf.contrib import FlaskDynaconf, DjangoDynaconf
      5 

~/miniconda3/envs/smr/lib/python3.7/site-packages/dynaconf/base.py in <module>
      6 
      7 from dynaconf import default_settings
----> 8 from dynaconf.loaders import (
      9     default_loader,
     10     settings_loader,

~/miniconda3/envs/smr/lib/python3.7/site-packages/dynaconf/loaders/__init__.py in <module>
      2 from dynaconf import constants as ct
      3 from dynaconf import default_settings
----> 4 from dynaconf.loaders import (
      5     yaml_loader, toml_loader, json_loader, ini_loader, py_loader
      6 )

~/miniconda3/envs/smr/lib/python3.7/site-packages/dynaconf/loaders/yaml_loader.py in <module>
      4 from warnings import warn
      5 from dynaconf import default_settings
----> 6 from dynaconf.loaders.base import BaseLoader
      7 from dynaconf.constants import YAML_EXTENSIONS
      8 from dynaconf.utils import object_merge

~/miniconda3/envs/smr/lib/python3.7/site-packages/dynaconf/loaders/base.py in <module>
      5 
      6 
----> 7 logger = raw_logger()
      8 
      9 

~/miniconda3/envs/smr/lib/python3.7/site-packages/dynaconf/utils/__init__.py in raw_logger()
     68         return setup_logger(
     69             "dynaconf",
---> 70             level=getattr(logging, level)
     71         )
     72     except ImportError:  # pragma: no cover

AttributeError: module 'logging' has no attribute 'true'

```

</details>

**Environment (please complete the following information):**
 - OS:  Linux/Ubuntu18.04
 - Dynaconf Version 2.0.0
 - Frameworks in use: Flask

**Additional context**

works perfectly in dynaconf < 2.0


Discussion:

Resolving patch:
diff --git a/dynaconf/utils/__init__.py b/dynaconf/utils/__init__.py
--- a/dynaconf/utils/__init__.py
+++ b/dynaconf/utils/__init__.py
@@ -70,7 +70,7 @@ def _logger(level):
             '[%(filename)s:%(lineno)d - %(funcName)s] %(message)s'
         ),
         datefmt='%Y-%m-%d:%H:%M:%S',
-        level=getattr(logging, level)
+        level=getattr(logging, level, 'DEBUG')
     )
     logger = logging.getLogger("dynaconf")
     return logger
diff --git a/dynaconf/utils/files.py b/dynaconf/utils/files.py
--- a/dynaconf/utils/files.py
+++ b/dynaconf/utils/files.py
@@ -3,6 +3,9 @@
 from dynaconf.utils import raw_logger, deduplicate
 
 
+logger = raw_logger()
+
+
 def _walk_to_root(path, break_at=None):
     """
     Directories starting from the given directory up to the root or break_at
@@ -19,7 +22,8 @@ def _walk_to_root(path, break_at=None):
     while last_dir != current_dir:
         paths.append(current_dir)
         paths.append(os.path.join(current_dir, 'config'))
-        if current_dir == os.path.abspath(break_at):  # pragma: no cover
+        if break_at and current_dir == os.path.abspath(break_at): # noqa
+            logger.debug('Reached the %s directory, breaking.', break_at)
             break
         parent_dir = os.path.abspath(os.path.join(current_dir, os.path.pardir))
         last_dir, current_dir = current_dir, parent_dir
@@ -42,7 +46,6 @@ def find_file(filename='.env', project_root=None, skip_files=None, **kwargs):
     For each path in the `search_tree` it will also look for an
     aditional `./config` folder.
     """
-    logger = raw_logger()
     search_tree = []
     work_dir = os.getcwd()
     skip_files = skip_files or []
@@ -55,8 +58,8 @@ def find_file(filename='.env', project_root=None, skip_files=None, **kwargs):
 
     script_dir = os.path.dirname(os.path.abspath(inspect.stack()[-1].filename))
 
-    # Path to invoked script and recurivelly to root with its ./config dirs
-    search_tree.extend(_walk_to_root(script_dir, break_at=work_dir))
+    # Path to invoked script and recursivelly to root with its ./config dirs
+    search_tree.extend(_walk_to_root(script_dir))
 
     # Where Python interpreter was invoked from and its ./config
     search_tree.extend([work_dir, os.path.join(work_dir, 'config')])


Test patch:
diff --git a/example/issues/160/test.sh b/example/issues/160/test.sh
new file mode 100755
--- /dev/null
+++ b/example/issues/160/test.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+echo 'Testing: Regression on config path-traversal #160'
+python -c "from dynaconf import settings; print(settings.ENV_FOR_DYNACONF)" | grep testissue160 || exit 1
+
+pushd subfolder
+python -c "from dynaconf import settings; print(settings.ENV_FOR_DYNACONF)" | grep testissue160 || exit 1
+popd