diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 5efb13594f5f0bea5dba30a590d1b3e5d9235391..7ad0a2d620b90445f604c282a3136178f093d8bb 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -1382,7 +1382,6 @@ include_directories(${NFAPI_USER_DIR})
 add_library(CN_UTILS
   ${OPENAIR3_DIR}/UTILS/conversions.c
   ${OPENAIR3_DIR}/UTILS/enum_string.c
-  ${OPENAIR3_DIR}/UTILS/log.c
   ${OPENAIR3_DIR}/UTILS/mcc_mnc_itu.c
   )
 
@@ -1557,7 +1556,6 @@ set(libnas_ies_OBJS
 set (libnas_utils_OBJS
   ${NAS_SRC}COMMON/UTIL/device.c
   ${NAS_SRC}COMMON/UTIL/memory.c
-  ${NAS_SRC}COMMON/UTIL/nas_log.c
   ${NAS_SRC}COMMON/UTIL/nas_timer.c
   ${NAS_SRC}COMMON/UTIL/socket.c
   ${NAS_SRC}COMMON/UTIL/stty.c
diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c
index 8b3026c22b96e2fa85bbe46c79561ab7266e6121..c9b1c32378f8a9276369151898b5188f0c5be9a8 100644
--- a/common/config/config_cmdline.c
+++ b/common/config/config_cmdline.c
@@ -38,7 +38,7 @@
 #include "config_userapi.h"
 
 
-void parse_stringlist(paramdef_t *cfgoptions, char *val)
+int parse_stringlist(paramdef_t *cfgoptions, char *val)
 {
 char *atoken;
 char *tokctx;
@@ -63,7 +63,7 @@ int   numelt=0;
       printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
       atoken=strtok_r(NULL, ",",&tokctx);
    }
-   cfgoptions->numelt=numelt; 
+   return (cfgoptions->numelt > 0); 
 }
  
 int processoption(paramdef_t *cfgoptions, char *value)
@@ -95,7 +95,7 @@ char defbool[2]="1";
         break;
 	
         case TYPE_STRINGLIST:
-           parse_stringlist(cfgoptions,tmpval); 
+           optisset=parse_stringlist(cfgoptions,tmpval); 
         break;
         case TYPE_UINT32:
        	case TYPE_INT32:
diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c
index 0eecd655d13ebc68e27487303c981d4492197012..7a840f22e2903042feeb3f95df1387febea3cfd3 100644
--- a/common/utils/LOG/log.c
+++ b/common/utils/LOG/log.c
@@ -235,14 +235,13 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length,
 void  log_getconfig(log_t *g_log) {
   char *gloglevel = NULL;
   int consolelog ;
-  int level;
   
   
   paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
   paramdef_t logparams_level[MAX_LOG_PREDEF_COMPONENTS];
   paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
   paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
-  paramdef_t logparams_genfile[sizeof(log_maskmap)/sizeof(mapping)];
+  paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
 
   int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
   if (ret <0) {
@@ -296,37 +295,37 @@ void  log_getconfig(log_t *g_log) {
   config_get( logparams_logfile,  MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX); 
 /* now set the log levels and infile option, according to what we read */
   for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
-    level     = map_str_to_int(log_level_names,    *(logparams_level[i].strptr));
-    set_log(i, level);
+    g_log->log_component[i].level = map_str_to_int(log_level_names,    *(logparams_level[i].strptr));
+    set_log(i, g_log->log_component[i].level);
     if (*(logparams_logfile[i].uptr) == 1)
         set_component_filelog(i);
   }
 
-/* build then read the debug and genfile parameter array */
+/* build then read the debug and dump parameter array */
   for (int i=0;log_maskmap[i].name != NULL ; i++) {
-      sprintf(logparams_debug[i].optname,    LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name);
-      sprintf(logparams_genfile[i].optname,   LOG_CONFIG_GENFILE_FORMAT, log_maskmap[i].name);
+      sprintf(logparams_debug[i].optname,  LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name);
+      sprintf(logparams_dump[i].optname,   LOG_CONFIG_DUMP_FORMAT, log_maskmap[i].name);
       logparams_debug[i].defuintval  = 0;
       logparams_debug[i].type        = TYPE_UINT;
       logparams_debug[i].paramflags  = PARAMFLAG_BOOL;
       logparams_debug[i].uptr        = NULL;
       logparams_debug[i].chkPptr     = NULL;
       logparams_debug[i].numelt      = 0;
-      logparams_genfile[i].defuintval  = 0;
-      logparams_genfile[i].type        = TYPE_UINT;
-      logparams_genfile[i].paramflags  = PARAMFLAG_BOOL;
-      logparams_genfile[i].uptr        = NULL;
-      logparams_genfile[i].chkPptr     = NULL;
-      logparams_genfile[i].numelt      = 0;
+      logparams_dump[i].defuintval  = 0;
+      logparams_dump[i].type        = TYPE_UINT;
+      logparams_dump[i].paramflags  = PARAMFLAG_BOOL;
+      logparams_dump[i].uptr        = NULL;
+      logparams_dump[i].chkPptr     = NULL;
+      logparams_dump[i].numelt      = 0;
   }
   config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
-  config_get( logparams_genfile,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
+  config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
 /* set the debug mask according to the debug parameters values */
   for (int i=0; log_maskmap[i].name != NULL ; i++) {
     if (*(logparams_debug[i].uptr) )
         g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value;
-    if (*(logparams_genfile[i].uptr) )
-        g_log->genfile_mask = g_log->genfile_mask | log_maskmap[i].value;
+    if (*(logparams_dump[i].uptr) )
+        g_log->dump_mask = g_log->dump_mask | log_maskmap[i].value;
   } 
 /* log globally enabled/disabled */
   set_glog_onlinelog(consolelog);
@@ -349,10 +348,9 @@ int computed_compidx=compidx;
   }
   if (computed_compidx >= 0 && computed_compidx <MAX_LOG_COMPONENTS) {
       g_log->log_component[computed_compidx].name = strdup(name);
-      g_log->log_component[computed_compidx].savedlevel = LOG_ERR;
       g_log->log_component[computed_compidx].stream = stdout;
       g_log->log_component[computed_compidx].filelog = 0;
-      g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/<name>.%s rounded to ^2 */
+      g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/<name>.%s  */
       sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext);
   } else {
       fprintf(stderr,"{LOG} %s %d Couldn't register componemt %s\n",__FILE__,__LINE__,name);
@@ -415,19 +413,15 @@ int logInit (void)
 
 
   register_log_component("SCTP","",SCTP);
-  register_log_component("RRH","",RRH);
- 
-
+  register_log_component("X2AP","",X2AP);
+  register_log_component("LOADER","log",LOADER);
+  register_log_component("ASN","log",ASN);
   
 
 
+  for (int i=0 ; log_level_names[i].name != NULL ; i++)
+      g_log->level2string[i]           = toupper(log_level_names[i].name[0]); // uppercased first letter of level name
 
-  g_log->level2string[OAILOG_ERR]           = "E"; // ERROR
-  g_log->level2string[OAILOG_WARNING]       = "W"; // WARNING
-  g_log->level2string[OAILOG_INFO]          = "I"; //INFO
-  g_log->level2string[OAILOG_DEBUG]         = "D"; // DEBUG
-//  g_log->level2string[OAILOG_FILE]          = "F"; // file
-  g_log->level2string[OAILOG_TRACE]         = "T"; // TRACE
 
  
 
@@ -459,11 +453,19 @@ int rt =   pthread_getname_np(pthread_self(), threadname,bufsize) ;
    }
 }
 
+int inline log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) {
+  char threadname[PR_SET_NAME];
+return  snprintf(log_buffer, buffsize , "%s%s[%s]%c %s %s",
+  	   log_level_highlight_end[level],
+  	   ( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
+  	   g_log->log_component[comp].name,
+  	   ( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '),
+  	   ( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
+  	   format);
+}
 
 void logRecord_mt(const char *file, const char *func, int line, int comp, int level, const char* format, ... )
   {
-
-  char threadname[PR_SET_NAME];
   char log_buffer[MAX_LOG_TOTAL];
   va_list args;
 
@@ -472,16 +474,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
 
 
 
-
-
-  snprintf(log_buffer, MAX_LOG_TOTAL , "%s%s[%s]%s %s %s",
-  	   log_level_highlight_end[level],
-  	   ( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
-  	   g_log->log_component[comp].name,
-  	   ( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:""),
-  	   ( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
-  	   format);
-
+  log_header(log_buffer,MAX_LOG_TOTAL ,comp, level,format);
   g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
   va_end(args);
 
@@ -492,20 +485,23 @@ void log_dump(int component, void *buffer, int buffsize,int datatype, const char
 va_list args;
 char *wbuf; 
 
+
     switch(datatype) {
        case LOG_DUMP_DOUBLE:
-            wbuf=malloc((buffsize * 10)  + 64 );
+            wbuf=malloc((buffsize * 10)  + 64 + MAX_LOG_TOTAL);
        break;
        case LOG_DUMP_CHAR:
        default:
-            wbuf=malloc((buffsize * 3 ) + 64 );
+            wbuf=malloc((buffsize * 3 ) + 64 + MAX_LOG_TOTAL);
        break;
-    }        
-    va_start(args, format);
-    g_log->log_component[component].vprint(g_log->log_component[component].stream,format, args);
-    va_end(args);
-    if (wbuf != NULL) {
-       int pos=0;
+    }
+    if (wbuf != NULL) {       
+       va_start(args, format);
+       int pos=log_header(wbuf,MAX_LOG_TOTAL ,component, OAILOG_INFO,"");
+       int pos2=vsprintf(wbuf+pos,format, args);
+       pos=pos+pos2;
+       va_end(args);
+      
        for (int i=0; i<buffsize; i++) {
             switch(datatype) {
                case LOG_DUMP_DOUBLE:
@@ -528,12 +524,12 @@ int set_log(int component, int level)
   /* Checking parameters */
   DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
            component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
-  DevCheck((level < NUM_LOG_LEVEL) && (level >= OAILOG_ERR), level, NUM_LOG_LEVEL,
+  DevCheck((level < NUM_LOG_LEVEL) && (level >= OAILOG_DISABLE), level, NUM_LOG_LEVEL,
            OAILOG_ERR);
 
-
+  if ( g_log->log_component[component].level != OAILOG_DISABLE )
+      g_log->log_component[component].savedlevel = g_log->log_component[component].level;
   g_log->log_component[component].level = level;
-  g_log->log_component[component].savedlevel = level;
 
   return 0;
 }
@@ -557,7 +553,7 @@ void set_glog_onlinelog(int enable)
         g_log->log_component[c].print = fprintf;
         g_log->log_component[c].stream = stdout;
       } else {
-        g_log->log_component[c].level = -1;
+        g_log->log_component[c].level = OAILOG_DISABLE;
       }
   }  
 }
diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h
index 7b2764b30cde2285dd2ff6953985be9003708bcc..767c1dbb356046a1eec1558fac95f44442d3019f 100644
--- a/common/utils/LOG/log.h
+++ b/common/utils/LOG/log.h
@@ -81,14 +81,14 @@ extern "C" {
  *  @ingroup _macro
  *  @brief LOG defines 9 levels of messages for users. Importance of these levels decrease gradually from 0 to 8
  * @{*/
-
-# define  OAILOG_ERR     0 /*!< \brief critical error conditions, impact on "must have" fuctinalities */
-# define  OAILOG_WARNING 1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
-# define  OAILOG_INFO    2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
-# define  OAILOG_DEBUG   3 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
-# define  OAILOG_TRACE   4 /*!< \brief  second level debug-level messages, for developers ,likely impact real-time behavior*/
-
-#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG */
+# define  OAILOG_DISABLE -1 /*!< \brief disable all LOG messages, cannot be used in LOG macros, use only in LOG module */
+# define  OAILOG_ERR      0 /*!< \brief critical error conditions, impact on "must have" fuctinalities */
+# define  OAILOG_WARNING  1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
+# define  OAILOG_INFO     2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
+# define  OAILOG_DEBUG    3 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
+# define  OAILOG_TRACE    4 /*!< \brief  second level debug-level messages, for developers ,likely impact real-time behavior*/
+
+#define NUM_LOG_LEVEL 5 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/
 /* @}*/
 
 
@@ -142,21 +142,27 @@ extern "C" {
 #define DEBUG_RRC          (1<<6)
 #define DEBUG_PDCP         (1<<7)
 #define DEBUG_DFT          (1<<8)
+#define DEBUG_ASN1         (1<<9)
 #define DEBUG_CTRLSOCKET   (1<<10)
+#define DEBUG_SECURITY     (1<<11)
+#define DEBUG_NAS          (1<<12)
 #define UE_TIMING          (1<<20)
 
 
 #define LOG_MASKMAP_INIT {\
   {"PRACH",       DEBUG_PRACH},\
   {"RU",          DEBUG_RU},\
-  {"LTEESTIM",    DEBUG_LTEESTIM},\
-  {"CTRLSOCKET",  DEBUG_CTRLSOCKET},\
   {"UE_PHYPROC",  DEBUG_UE_PHYPROC},\
+  {"LTEESTIM",    DEBUG_LTEESTIM},\
   {"DLCELLSPEC",  DEBUG_DLCELLSPEC},\
   {"ULSCH",       DEBUG_ULSCH},\
   {"RRC",         DEBUG_RRC},\
   {"PDCP",        DEBUG_PDCP},\
   {"DFT",         DEBUG_DFT},\
+  {"ASN1",        DEBUG_ASN1},\
+  {"CTRLSOCKET",  DEBUG_CTRLSOCKET},\
+  {"SECURITY",    DEBUG_SECURITY},\
+  {"NAS",         DEBUG_NAS},\
   {"UE_TIMING",   UE_TIMING},\
   {NULL,-1}\
 }
@@ -166,8 +172,8 @@ extern "C" {
 #define SET_LOG_DEBUG(B)   g_log->debug_mask = (g_log->debug_mask | B)
 #define CLEAR_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask & (~B))
 
-#define SET_LOG_DUMP(B)   g_log->genfile_mask = (g_log->genfile_mask | B)
-#define CLEAR_LOG_DUMP(B) g_log->genfile_mask = (g_log->genfile_mask & (~B))
+#define SET_LOG_DUMP(B)   g_log->dump_mask = (g_log->dump_mask | B)
+#define CLEAR_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask & (~B))
 
 
 
@@ -208,9 +214,9 @@ typedef enum {
     TMR,
     USIM,
     LOCALIZE,
-    RRH,
     X2AP,
     LOADER,
+    ASN,
     MAX_LOG_PREDEF_COMPONENTS,
 }
 comp_name_t;
@@ -243,11 +249,11 @@ typedef struct  {
 
 typedef struct {
     log_component_t         log_component[MAX_LOG_COMPONENTS];
-    char*                   level2string[NUM_LOG_LEVEL];
+    char                    level2string[NUM_LOG_LEVEL];
     int                     flag;
     char*                   filelog_name;
     uint64_t                debug_mask;
-    uint64_t                genfile_mask;
+    uint64_t                dump_mask;
 } log_t;
 
 
@@ -318,7 +324,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
 #define LOG_CONFIG_LEVEL_FORMAT                            "%s_log_level"
 #define LOG_CONFIG_LOGFILE_FORMAT                          "%s_log_infile"
 #define LOG_CONFIG_DEBUG_FORMAT                            "%s_debug"
-#define LOG_CONFIG_GENFILE_FORMAT                           "%s_genfile"
+#define LOG_CONFIG_DUMP_FORMAT                             "%s_dump"
 
 #define LOG_CONFIG_HELP_OPTIONS      " list of comma separated options to enable log module behavior. Available options: \n"\
                                      " nocolor:   disable color usage in log messages\n"\
@@ -356,13 +362,13 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
 #    define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG  ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x)   ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x))   ;}} while (0) 
 #    define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE  ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x)   ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x))   ;}} while (0) 
     /* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
-#    define LOG_DUMPMSG(c, f, b, s, x...) do {  if(g_log->genfile_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x)  ;}   while (0)  /* */
+#    define LOG_DUMPMSG(c, f, b, s, x...) do {  if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x)  ;}   while (0)  /* */
 #    define nfapi_log(FILE, FNC, LN, COMP, LVL, F...)  do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F)  ;}}   while (0)  /* */
      /* bitmask dependant macros, to isolate debugging code */
 #    define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
 
      /* bitmask dependant macros, to generate debug file such as matlab file or message dump */
-#    define LOG_GENFILEFLAG(D) (g_log->genfile_mask & D)
+#    define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
 #    define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
      /* define variable only used in LOG macro's */
 #    define LOG_VAR(A,B) A B
@@ -376,12 +382,13 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
 #    define LOG_DUMPMSG(c, b, s, x...) /* */
 #    define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...) 
 #    define LOG_DEBUGFLAG(D)  ( 0 )
-#    define LOG_GENFILEFLAG(D) ( 0 ) 
+#    define LOG_DUMPFLAG(D) ( 0 ) 
 #    define LOG_M(file, vector, data, len, dec, format) 
 #    define LOG_VAR(A,B)
 #  endif /* T_TRACER */
 /* avoid warnings for variables only used in LOG macro's but set outside debug section */
-#define LOG_USEDINLOG_VAR(A,B) __attribute__((unused)) A B 
+#define	GCC_NOTUSED		__attribute__((unused))
+#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B 
 
 /* unfiltered macros, usefull for simulators or messages at init time, before log is configured */
 #define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
@@ -394,9 +401,12 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
  *  @ingroup _macro
  *  @brief Macro of some useful functions defined by LOG
  * @{*/
-#define LOG_ENTER(c) do {LOG_T(c, "Entering\n");}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
-#define LOG_EXIT(c) do {LOG_T(c,"Exiting\n"); return;}while(0)  /*!< \brief Macro to log a message with severity TRACE when exiting a function */
-#define LOG_RETURN(c,x) do {uint32_t __rv;__rv=(unsigned int)(x);LOG_T(c,"Returning %08x\n", __rv);return((typeof(x))__rv);}while(0)  /*!< \brief Macro to log a function exit, including integer value, then to return a value to the calling function */
+#define LOG_ENTER(c) do {LOG_T(c, "Entering %s\n",__FUNCTION__);}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
+#define LOG_END(c) do {LOG_T(c, "End of  %s\n",__FUNCTION__);}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
+#define LOG_EXIT(c)  do { LOG_END(c); return;}while(0)  /*!< \brief Macro to log a message with severity TRACE when exiting a function */
+#define LOG_RETURN(c,r) do {LOG_T(c,"Leaving %s (rc = %08lx)\n", __FUNCTION__ , (unsigned long)(r) );return(r);}while(0)  /*!< \brief Macro to log a function exit, including integer value, then to return a value to the calling function */
+
+
 /* @}*/
 
 static __inline__ uint64_t rdtsc(void) {
diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt
index 676f329a0eb08fc4c2fb8e4efb2c69345e671f0e..2bce891ac93c425321f5aa05580498c7e1b9b4b3 100644
--- a/common/utils/T/T_messages.txt
+++ b/common/utils/T/T_messages.txt
@@ -750,6 +750,27 @@ ID = LEGACY_OSA_TRACE
     GROUP = ALL:LEGACY_OSA:LEGACY_GROUP_TRACE:LEGACY
     FORMAT = string,log
 
+ID = LEGACY_ASN_INFO
+    DESC = ASN legacy logs - info level
+    GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_INFO:LEGACY
+    FORMAT = string,log
+ID = LEGACY_ASN_ERROR
+    DESC = ASN legacy logs - error level
+    GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_ERROR:LEGACY
+    FORMAT = string,log
+ID = LEGACY_ASN_WARNING
+    DESC = ASN legacy logs - warning level
+    GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_WARNING:LEGACY
+    FORMAT = string,log
+ID = LEGACY_ASN_DEBUG
+    DESC = ASN legacy logs - debug level
+    GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_DEBUG:LEGACY
+    FORMAT = string,log
+ID = LEGACY_ASN_TRACE
+    DESC = ASN legacy logs - trace level
+    GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_TRACE:LEGACY
+    FORMAT = string,log
+
 ID = LEGACY_SIM_INFO
     DESC = SIM legacy logs - info level
     GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_INFO:LEGACY
diff --git a/common/utils/itti/signals.c b/common/utils/itti/signals.c
index 5dd667ae653a115e53ca18362ce1d2cec9d0ed2f..f8dfe2d49bb97071c9f28dab06838b92b10d83e4 100644
--- a/common/utils/itti/signals.c
+++ b/common/utils/itti/signals.c
@@ -39,7 +39,7 @@
 #include "assertions.h"
 
 #include "signals.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 
 #if defined (LOG_D) && defined (LOG_E)
 # define SIG_DEBUG(x, args...)  LOG_D(RRC, x, ##args)
diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c
index 6327aeacfb675140bda39f76feed86ddc2541c18..720cf70d1f428b8457bd5bf648480155d5c0c67f 100644
--- a/common/utils/itti/timer.c
+++ b/common/utils/itti/timer.c
@@ -32,7 +32,7 @@
 #include "assertions.h"
 #include "intertask_interface.h"
 #include "timer.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 #include "queue.h"
 
 #if defined (LOG_D) && defined (LOG_E)
diff --git a/common/utils/telnetsrv/telnetsrv_proccmd.c b/common/utils/telnetsrv/telnetsrv_proccmd.c
index 3576fd004a05311bc544b6082818da8ae86bcf00..ba1b01151391d5ed884ae961f22c7c394c0cf0c9 100644
--- a/common/utils/telnetsrv/telnetsrv_proccmd.c
+++ b/common/utils/telnetsrv/telnetsrv_proccmd.c
@@ -221,7 +221,7 @@ int proccmd_show(char *buf, int debug, telnet_printfunc_t prnt)
        for (int i=0; log_maskmap[i].name != NULL ; i++) {
                prnt("%02i %17.17s %5.5s   %5.5s\n",i ,log_maskmap[i].name, 
 	             ((g_log->debug_mask &  log_maskmap[i].value)?"Y":"N"),
-                     ((g_log->genfile_mask & log_maskmap[i].value)?"Y":"N") );
+                     ((g_log->dump_mask & log_maskmap[i].value)?"Y":"N") );
        }
    }
    if (strcasestr(buf,"config") != NULL) {
@@ -343,7 +343,7 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
           for (int i=0; log_options[i].name != NULL; i++)
              prnt("%s ",log_options[i].name);
           prnt("\n\n");
-          prnt("Available debug or genfile options: \n   ");
+          prnt("Available debug and dump options: \n   ");
           for (int i=0; log_maskmap[i].name != NULL; i++)
              prnt("%s ",log_maskmap[i].name);
           prnt("\n\n");
@@ -402,31 +402,36 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
       if (logparam != NULL) free(logparam);
       if (opt != NULL)      free(opt); 
    } else if ( s == 3 && logsubcmd != NULL) {
-      int level, enable, filelog;
+      int level, enable,filelog;
       char *tmpstr=NULL;
       char *logparam=NULL;
       int l;
 
-      level = enable = filelog = -1;
+      level = OAILOG_DISABLE - 1;
+      filelog = -1;
+      enable=-1; 
       l=sscanf(logsubcmd,"%m[^'_']_%m[^'_']",&logparam,&tmpstr);
       if (debug > 0)
           prnt("l=%i, %s %s\n",l,((logparam==NULL)?"\"\"":logparam), ((tmpstr==NULL)?"\"\"":tmpstr));
       if (l ==2 ) {
          if (strcmp(logparam,"level") == 0) {
              level=map_str_to_int(log_level_names,tmpstr);
-             if (level < 0)  prnt("level %s unknown\n",tmpstr);
+             if (level < 0) {
+                 prnt("level %s unknown\n",tmpstr);
+                 level=OAILOG_DISABLE - 1;
+              }
          } else {
              prnt("%s%s unknown log sub command \n",logparam, tmpstr);
          }
       } else if (l ==1 ) {
          if (strcmp(logparam,"enable") == 0) {
-              enable = 1;
+            enable=1;
          } else if (strcmp(logparam,"disable") == 0) {
-              enable = 0;
+             level=OAILOG_DISABLE;
          } else if (strcmp(logparam,"file") == 0) {
-              filelog = 1 ;
+             filelog = 1 ;
          } else if (strcmp(logparam,"nofile") == 0) {
-              filelog = 0 ;
+             filelog = 0 ;
          } else {
              prnt("%s%s unknown log sub command \n",logparam, tmpstr);
          }
@@ -436,27 +441,18 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
       if (logparam != NULL) free(logparam);
       if (tmpstr != NULL)   free(tmpstr);
       for (int i=idx1; i<=idx2 ; i++) {
-        if ( level >= 0 || enable >= 0) {
-          if (level < 0) {
-              level=g_log->log_component[i].level;
-           }
-          if (enable < 0) {
-              level= -1;
-           }
-          set_log(i, level);
-        }
-        if ( filelog == 1 ) {
+        if (level >= OAILOG_DISABLE)
+           set_log(i, level);
+        else if ( enable == 1)
+           set_log(i,g_log->log_component[i].savedlevel);
+        else if ( filelog == 1 ) {
            set_component_filelog(i);
-        }
-        if ( filelog == 0 ) {
+        } else if ( filelog == 0 ) {
            close_component_filelog(i);
         } 
-        prnt("log level  comp %i %s set to %s (%s)   output: %s\n",
-              i,((g_log->log_component[i].name==NULL)?"":g_log->log_component[i].name),
-              map_int_to_str(log_level_names,g_log->log_component[i].level),
-              ((g_log->log_component[i].level>=0)?"enabled":"disabled"),
-              ((g_log->log_component[i].filelog>0)?g_log->log_component[i].filelog_name:"stdout"));	  
-      }     
+          
+      }
+     proccmd_show("loglvl",debug,prnt);
    } else {
        prnt("%s: wrong log command...\n",buf);
    }
diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c
index 3b8a26125d43fda03bb8a86f1460277a73bd42a5..03f226c6379098a05a56f92ce286db5a83a9d0bb 100644
--- a/openair1/PHY/INIT/lte_parms.c
+++ b/openair1/PHY/INIT/lte_parms.c
@@ -20,7 +20,7 @@
  */
 
 #include "phy_init.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 
 uint16_t dl_S_table_normal[10]={3,9,10,11,12,3,9,10,11,6};
 uint16_t dl_S_table_extended[10]={3,8,9,10,3,8,9,5,0,0};
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index aca5a5303d7d4503471b77f54534b7e1c1916d61..87abdfe19cb67567344ec6507b807290c8a2e33e 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -274,7 +274,7 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms )   // LTE_UE_COMMON *com
 
 
 
-  if ( LOG_GENFILEFLAG(DEBUG_LTEESTIM)){
+  if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){
     LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
     LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
     LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
@@ -460,7 +460,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
   LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
 
 
-  if ( LOG_GENFILEFLAG(DEBUG_LTEESTIM)){
+  if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){
     static int debug_cnt;
     if (debug_cnt == 0) {
       LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
index bf228021452834bb65f3dddf8bfa3a168b367c95..2e4f3e60361eeb564e376435a34fcd8b9443982c 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
@@ -23,7 +23,7 @@
 
 #include "PHY/defs_UE.h"
 #include "PHY/phy_extern_ue.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 #include "PHY/sse_intrin.h"
 
 //#define k1 1000
diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c
index 2c5240e14329452b2c294c8e8bde8b994278531c..1b9c17133c050dceea97d78391659003db3f30d0 100644
--- a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c
+++ b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c
@@ -36,7 +36,7 @@
 #include "lte_refsig.h"
 #include "PHY/defs_eNB.h"
 #include "PHY/defs_UE.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 #include "PHY/impl_defs_top.h"
 
 //extern unsigned int lte_gold_table[3][20][2][14];
diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c
index 99563ce13358acaa153d9128ea7ca527e580e52d..ec0b7db4ad7d003398dfddd842f935f6639b0743 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach.c
@@ -202,7 +202,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
       // DJP - indexing below in subframe zero takes us off the beginning of the array???
       prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
 
-        if (LOG_GENFILEFLAG(PRACH)){
+        if (LOG_DUMPFLAG(PRACH)){
           int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
           int8_t dbEn0 = dB_fixed(en0);
           int8_t rach_dBm = dbEn0 - ru->rx_total_gain_dB;
@@ -585,7 +585,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 	}
 
       memset(prachF, 0, sizeof(int16_t)*2*1024 );
-      if (LOG_GENFILEFLAG(PRACH)) {      
+      if (LOG_DUMPFLAG(PRACH)) {      
         if (prach[0]!= NULL) LOG_M("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
          LOG_M("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
          LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1);
@@ -619,7 +619,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 	    prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
 	}
 
-        if (LOG_GENFILEFLAG(PRACH)) {	
+        if (LOG_DUMPFLAG(PRACH)) {	
 	  if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
           if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
         }
@@ -662,7 +662,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
       }
   }// preamble_index
 
-  if (LOG_GENFILEFLAG(PRACH)) {
+  if (LOG_DUMPFLAG(PRACH)) {
     int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));  
     if (en>60) {
       k = (12*n_ra_prb) - 6*fp->N_RB_UL;
@@ -689,7 +689,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
       }
 
     }
-  } /* LOG_GENFILEFLAG(PRACH) */
+  } /* LOG_DUMPFLAG(PRACH) */
   if (eNB) stop_meas(&eNB->rx_prach);
 
 }
diff --git a/openair1/PHY/TOOLS/lte_dfts.c b/openair1/PHY/TOOLS/lte_dfts.c
index ca1a6d12625b1056ed23c45296cb0b3f64de63c8..7e24af179d756380b1327bb07674d1b6adf5ab97 100644
--- a/openair1/PHY/TOOLS/lte_dfts.c
+++ b/openair1/PHY/TOOLS/lte_dfts.c
@@ -2035,7 +2035,7 @@ static inline void transpose4_ooff(int16x4_t *x,int16x4_t *y,int off)
 
 #endif
 
-// 16-point optimized DEBUG_DFT kernel
+// 16-point optimized DFT kernel
 
 const static int16_t tw16[24] __attribute__((aligned(32))) = { 32767,0,30272,-12540,23169 ,-23170,12539 ,-30273,
                                                   32767,0,23169,-23170,0     ,-32767,-23170,-23170,
@@ -3097,7 +3097,7 @@ void dft128(int16_t *x,int16_t *y,int scale)
 
   dft64((int16_t*)(xtmp),(int16_t*)ytmp,1);
   dft64((int16_t*)(xtmp+32),(int16_t*)(ytmp+16),1);
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("dft128a.m","dfta",ytmp,64,1,1);
     LOG_M("dft128b.m","dftb",ytmp+16,64,1,1);*/
   }
@@ -3149,7 +3149,7 @@ void dft128(int16_t *x,int16_t *y,int scale)
 
 
   }
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
      LOG_M("dft128out.m","dft128",y,128,1,1);
      exit(-1);
   }
@@ -3177,14 +3177,14 @@ void dft128(int16_t *x,int16_t *y,int scale)
   transpose4_ooff_simd256(x256+10,xtmp+5,8);
   transpose4_ooff_simd256(x256+12,xtmp+6,8);
   transpose4_ooff_simd256(x256+14,xtmp+7,8);
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {  
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {  
      LOG_M("dft128ina_256.m","dftina",xtmp,64,1,1);
      LOG_M("dft128inb_256.m","dftinb",xtmp+8,64,1,1);
   }
 
   dft64((int16_t*)(xtmp),(int16_t*)ytmp,1);
   dft64((int16_t*)(xtmp+8),(int16_t*)(ytmp+8),1);
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {  
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {  
     LOG_M("dft128outa_256.m","dftouta",ytmp,64,1,1);
     LOG_M("dft128outb_256.m","dftoutb",ytmp+8,64,1,1);
   }
@@ -3220,7 +3220,7 @@ void dft128(int16_t *x,int16_t *y,int scale)
     y256[15] = mulhi_int16_simd256(y256[15],ONE_OVER_SQRT2_Q15_256);
 
   }
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {  
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {  
    LOG_M("dft128.m","dft",y256,128,1,1);
    exit(-1);
   }
@@ -5424,7 +5424,7 @@ void dft1536(int16_t *input, int16_t *output, int scale)
     tmpo[1][i] = tmpo[1][i<<1];
     tmpo[2][i] = tmpo[2][i<<1];
     }*/
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("dft1536out0.m","o0",tmpo[0],2048,1,1);
     LOG_M("dft1536out1.m","o1",tmpo[1],2048,1,1);
     LOG_M("dft1536out2.m","o2",tmpo[2],2048,1,1);
@@ -5588,7 +5588,7 @@ void idft6144(int16_t *input, int16_t *output,int scale)
   idft2048((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1);
   idft2048((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1);
 
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("idft6144in.m","in",input,6144,1,1);
     LOG_M("idft6144out0.m","o0",tmpo[0],2048,1,1);
     LOG_M("idft6144out1.m","o1",tmpo[1],2048,1,1);
@@ -5624,9 +5624,6 @@ void idft6144(int16_t *input, int16_t *output,int scale)
     }
   }
 
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
-   LOG_M("idft6144out.m","out",output,6144,1,1);
-  }
   _mm_empty();
   _m_empty();
 
@@ -5657,7 +5654,7 @@ void dft6144(int16_t *input, int16_t *output,int scale)
     tmpo[1][i] = tmpo[1][i<<1];
     tmpo[2][i] = tmpo[2][i<<1];
     }*/
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("ft6144out0.m","o0",tmpo[0],2048,1,1);
     LOG_M("ft6144out1.m","o1",tmpo[1],2048,1,1);
     LOG_M("ft6144out2.m","o2",tmpo[2],2048,1,1);
@@ -5722,7 +5719,7 @@ void dft12288(int16_t *input, int16_t *output,int scale)
     tmpo[1][i] = tmpo[1][i<<1];
     tmpo[2][i] = tmpo[2][i<<1];
     }*/
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("dft12288out0.m","o0",tmpo[0],4096,1,1);
     LOG_M("dft12288out1.m","o1",tmpo[1],4096,1,1);
     LOG_M("dft12288out2.m","o2",tmpo[2],4096,1,1);
@@ -5779,7 +5776,7 @@ void idft12288(int16_t *input, int16_t *output,int scale)
   idft4096((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),scale);
   idft4096((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),scale);
 
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("idft12288in.m","in",input,12288,1,1);
     LOG_M("idft12288out0.m","o0",tmpo[0],4096,1,1);
     LOG_M("idft12288out1.m","o1",tmpo[1],4096,1,1);
@@ -5815,7 +5812,7 @@ void idft12288(int16_t *input, int16_t *output,int scale)
   }
   _mm_empty();
   _m_empty();
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
      LOG_M("idft12288out.m","out",output,6144,1,1);
   }
 }
@@ -5946,7 +5943,7 @@ void dft24576(int16_t *input, int16_t *output,int scale)
     tmpo[1][i] = tmpo[1][i<<1];
     tmpo[2][i] = tmpo[2][i<<1];
     }*/
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("dft24576out0.m","o0",tmpo[0],8192,1,1);
     LOG_M("dft24576out1.m","o1",tmpo[1],8192,1,1);
     LOG_M("dft24576out2.m","o2",tmpo[2],8192,1,1);
@@ -5981,14 +5978,12 @@ void dft24576(int16_t *input, int16_t *output,int scale)
   }
   _mm_empty();
   _m_empty();
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
      LOG_M("out.m","out",output,24576,1,1);
   }
 }
 
-
-
-void idft24576(int16_t *input, int16_t *output)
+void idft24576(int16_t *input, int16_t *output,int scale)
 {
   int i,i2,j;
   uint32_t tmp[3][8192] __attribute__((aligned(32)));
@@ -6006,7 +6001,7 @@ void idft24576(int16_t *input, int16_t *output)
   idft8192((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1);
   idft8192((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1);
   
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("idft24576in.m","in",input,24576,1,1);
     LOG_M("idft24576out0.m","o0",tmpo[0],8192,1,1);
     LOG_M("idft24576out1.m","o1",tmpo[1],8192,1,1);
@@ -6042,7 +6037,7 @@ void idft24576(int16_t *input, int16_t *output)
   _mm_empty();
   _m_empty();
 
-  if (LOG_GENFILEFLAG(DEBUG_DFT)) {
+  if (LOG_DUMPFLAG(DEBUG_DFT)) {
     LOG_M("idft24576out.m","out",output,24576,1,1);
   }
 }
diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h
index bb08d5122dd68033f1c7871a37faabd4a1355a68..8a7c853df55d10fbd148d94077683eabfd873a39 100644
--- a/openair1/PHY/defs_L1_NB_IoT.h
+++ b/openair1/PHY/defs_L1_NB_IoT.h
@@ -52,7 +52,7 @@
 #     include "COMMON/ral_messages_types.h"
 #     include "UTIL/queue.h"
 #   endif
-#   include "log.h"
+#   include "common/utils/LOG/log.h"
 #   define msg(aRGS...) LOG_D(PHY, ##aRGS)
 # else
 #   define msg printf
diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h
index f079794a34afa069d83032b6f0e20a00353d50e4..55f8c9639ab281316a25784b62f45811c69d9203 100644
--- a/openair1/PHY/defs_UE.h
+++ b/openair1/PHY/defs_UE.h
@@ -93,7 +93,7 @@
 #     include "COMMON/ral_messages_types.h"
 #     include "UTIL/queue.h"
 #   endif
-#   include "log.h"
+#   include "common/utils/LOG/log.h"
 #   define msg(aRGS...) LOG_D(PHY, ##aRGS)
 # else
 #   define msg printf
diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c
index 2b35ad936b779bd08e1c7038dcb636f013fc1a21..f8d1a3bae81b42a2a5a6d6ea2fc87b1c55fb3ac7 100644
--- a/openair1/SCHED_UE/phy_procedures_lte_ue.c
+++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c
@@ -99,7 +99,7 @@ void get_dumpparam(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, uint8_t
 
 void dump_dlsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid)
 {
-  if (LOG_GENFILEFLAG(DEBUG_UE_PHYPROC)) { 
+  if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) { 
     unsigned int coded_bits_per_codeword;
     uint8_t nsymb ;
 
@@ -131,7 +131,7 @@ void dump_dlsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subf
 
 void dump_dlsch_SI(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe)
 {
-  if (LOG_GENFILEFLAG(DEBUG_UE_PHYPROC)){
+  if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)){
     unsigned int coded_bits_per_codeword;
     uint8_t nsymb;
 
@@ -234,7 +234,7 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb
 
 void dump_dlsch_ra(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe)
 {
-  if (LOG_GENFILEFLAG(DEBUG_UE_PHYPROC)){
+  if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)){
     unsigned int coded_bits_per_codeword;
     uint8_t nsymb ;
 
@@ -2708,7 +2708,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
 
   } else { 
 
-    if (LOG_GENFILEFLAG(DEBUG_UE_PHYPROC)) {
+    if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) {
       LOG_E(PHY,"[UE %d] frame %d, subframe %d, Error decoding PBCH!\n",
       ue->Mod_id,frame_rx, subframe_rx);
 
@@ -4906,7 +4906,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,
     start_meas(&ue->generic_stat);
   }
 
-  if (LOG_GENFILEFLAG(DEBUG_UE_PHYPROC)) {
+  if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) {
     if(subframe_rx==5 &&  ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid]->nb_rb > 20){
   	 //LOG_M("decoder_llr.m","decllr",dlsch_llr,G,1,0);
   	 //LOG_M("llr.m","llr",  &ue->pdsch_vars[eNB_id]->llr[0][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0);
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
index 0545eeb3be11e59522aebcafb3161b4aaa61e60a..549c7eaa2227e944a98747b6bcdd2f8a2ac73207 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
@@ -38,7 +38,7 @@
 
 #include "liblfds700.h"
 
-#include "log.h"
+#include "common/utils/LOG/log.h"
 
 /*Flags showing if a mac agent has already been registered*/
 unsigned int mac_agent_registered[NUM_MAX_ENB];
diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
index e5e242232ced64c83f8d021fd99c0a4c16aba3cb..b4bf0293731620731fc25ffb03268e3b17a1fcfc 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
+++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
@@ -31,7 +31,7 @@
 
 #include "liblfds700.h"
 
-#include "log.h"
+#include "common/utils/LOG/log.h"
 
 /*Trigger boolean for RRC measurement*/
 bool triggered_rrc = false;
diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index 6f1b66c6d03ee4a3480ca17b125966d962661b13..9490c3f5d86caa29f0baa449d4ac93f5cce8570b 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -35,7 +35,7 @@
 #include "assertions.h"
 #include "common/ran_context.h"
 
-#include "log.h"
+#include "common/utils/LOG/log.h"
 
 #if defined(ENABLE_ITTI)
 # include "intertask_interface.h"
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 07eb5c57c7bc48ca62de8da58194992eccca83c5..4cca5ff8fe256ed95fbfd1a552fa0a26c98d561e 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -571,26 +571,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
   AssertFatal (i<num_enbs,
    	       "Failed to parse config file no %ith element in %s \n",i, ENB_CONFIG_STRING_ACTIVE_ENBS);
   
-#if defined(ENABLE_ITTI)
-
-  if (EPC_MODE_ENABLED) {
-    if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) {
-      asn_debug      = 0;
-      asn1_xer_print = 0;
-    } else if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0) {
-      asn_debug      = 1;
-      asn1_xer_print = 1;
-    } else if (strcasecmp(*(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr) , ENB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING) == 0) {
-      asn_debug      = 1;
-      asn1_xer_print = 2;
-    } else {
-      asn_debug      = 0;
-      asn1_xer_print = 0;
-    }
-  }
-
-#endif
-  
 
   
   if (num_enbs>0) {
@@ -2231,24 +2211,7 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) {
   
   config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
   
-#if defined(ENABLE_ITTI) 
-    if (EPC_MODE_ENABLED) {
-      if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) {
-  	asn_debug      = 0;
-  	asn1_xer_print = 0;
-      } else if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0) {
-  	asn_debug      = 1;
-  	asn1_xer_print = 1;
-      } else if (strcasecmp(*(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr) , ENB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING) == 0) {
-  	asn_debug      = 1;
-  	asn1_xer_print = 2;
-      } else {
-  	asn_debug      = 0;
-  	asn1_xer_print = 0;
-      }
-    }
 
-#endif
 
     AssertFatal (i<ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt,
 		 "Failed to parse config file %s, %uth attribute %s \n",
diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h
index c25bd13c9b766cff9723de506365792d7108337c..0ea5c81c873e71484c8e187d483631a036021e87 100755
--- a/openair2/ENB_APP/enb_paramdef.h
+++ b/openair2/ENB_APP/enb_paramdef.h
@@ -55,11 +55,6 @@
 
 
 
-#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
-extern int asn_debug;
-extern int asn1_xer_print;
-#endif
-
 #ifdef LIBCONFIG_LONG
 #define libconfig_int long
 #else
diff --git a/openair2/ENB_APP/flexran_agent.h b/openair2/ENB_APP/flexran_agent.h
index aed8f9eb60dc386700e74fbd1eeb7e7fddd5f96b..4ce727ff1c7c89e305ccb7ff2d1641010122e64a 100644
--- a/openair2/ENB_APP/flexran_agent.h
+++ b/openair2/ENB_APP/flexran_agent.h
@@ -39,7 +39,7 @@
 #include "flexran_agent_mac.h"
 #include "flexran_agent_rrc.h"
 #include "flexran_agent_pdcp.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 #include "assertions.h"
 
 /* Initiation of the eNodeB agent */
diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c
index 3bbea167d37dfacf1e8e2ca6cc0c576a2918f18d..db1943c9451f15304902cefd1d5ee080897280bf 100644
--- a/openair2/ENB_APP/flexran_agent_common.c
+++ b/openair2/ENB_APP/flexran_agent_common.c
@@ -36,7 +36,7 @@
 #include "flexran_agent_net_comm.h"
 #include "flexran_agent_ran_api.h"
 //#include "PHY/extern.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 
 //#include "SCHED/defs.h"
 #include "RRC/LTE/rrc_extern.h"
diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c
index d4c82e4dff127b12828c1a72ed6779705cf73714..66123fd71c60197ec9c40297bce7dc59f1e66343 100644
--- a/openair2/ENB_APP/flexran_agent_handler.c
+++ b/openair2/ENB_APP/flexran_agent_handler.c
@@ -33,7 +33,7 @@
 #include "flexran_agent_pdcp.h"
 #include "flexran_agent_timer.h"
 #include "flexran_agent_ran_api.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 
 #include "assertions.h"
 
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h
index 3354d8ace875da91ed0dc6fc9b53f5fca5225877..dacca55ab78a2bba6f642c25bc7e5d710429ba3a 100644
--- a/openair2/ENB_APP/flexran_agent_ran_api.h
+++ b/openair2/ENB_APP/flexran_agent_ran_api.h
@@ -43,7 +43,7 @@
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
 #include "RRC/LTE/rrc_eNB_UE_context.h"
 #include "PHY/phy_extern.h"
-#include "log.h"
+#include "common/utils/LOG/log.h"
 
 /****************************
  * get generic info from RAN
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
index 49cc68b06a65505bd24db81ed945efa4952978af..111e0d4161ff427c1d5f8f7f5219664b1f21506d 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
@@ -211,7 +211,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
   int               sched_frame=frameP;
   int               sched_subframe = (subframeP+4)%10;
   uint16_t          ul_req_index;
-  uint8_t           dlsch_flag;
+
   
   if (sched_subframe<subframeP) sched_frame++;
 
@@ -306,10 +306,9 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
 	  hi_dci0_req_body->number_of_dci++;
 	    
 	  ul_req_index = 0;
-            dlsch_flag = 0;
+
             for(ul_req_index = 0;ul_req_index < ul_req->number_of_pdus;ul_req_index++){
               if(ul_req->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){
-                dlsch_flag = 1;
                 LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index);
                 break;
               }
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
index 66aae4237ab2d5103f2431fefc9ae44ba8bb607e..3a1e7eed87d9bb64b88bf85a8e2a02fd8b18b6b3 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
@@ -91,7 +91,6 @@
 #define msg printf
 #endif
 
-//#define XER_PRINT
 
 typedef struct xer_sprint_string_s {
   char *string;
@@ -1353,9 +1352,9 @@ uint8_t do_SIB23(uint8_t Mod_id,
   }
 #endif
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message,
                                    NULL,
                                    (void*)bcch_message,
@@ -1607,9 +1606,9 @@ uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer,  SL_Destinatio
       break;
    }
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
-#endif
+   if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
+   }
 
 
    enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
@@ -2165,9 +2164,9 @@ do_RRCConnectionSetup(
 #endif
 
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
                                    NULL,
                                    (void*)&dl_ccch_msg,
@@ -2240,9 +2239,9 @@ do_SecurityModeCommand(
   dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm
     = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm;
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
                                    NULL,
                                    (void*)&dl_dcch_msg,
@@ -2320,9 +2319,9 @@ do_UECapabilityEnquiry(
   ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list,
                    &rat);
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
                                    NULL,
                                    (void*)&dl_dcch_msg,
@@ -2539,9 +2538,9 @@ do_RRCConnectionReconfiguration(
            enc_rval.failed_type->name, enc_rval.encoded);
      return -1;
   }
-#ifdef XER_PRINT
-  xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg);
+  }
 
 #if defined(ENABLE_ITTI)
 # if !defined(DISABLE_XER_SPRINT)
@@ -2742,9 +2741,9 @@ do_RRCConnectionReestablishment(
 
   rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nonCriticalExtension = NULL;
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
                                    NULL,
                                    (void*)&dl_ccch_msg,
@@ -2804,9 +2803,9 @@ do_RRCConnectionReestablishmentReject(
   // RRCConnectionReestablishmentReject
   rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8;
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
                                    NULL,
                                    (void*)&dl_ccch_msg,
@@ -2867,9 +2866,9 @@ do_RRCConnectionReject(
   /* let's put a wait time of 1s for the moment */
   rrcConnectionReject->criticalExtensions.choice.c1.choice.rrcConnectionReject_r8.waitTime = 1;
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
                                    NULL,
                                    (void*)&dl_ccch_msg,
@@ -3061,9 +3060,9 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
   */
   ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->pmch_InfoList_r9.list,pmch_Info_1);
 
-#ifdef XER_PRINT
-  xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message,
                                    NULL,
                                    (void*)mcch_message,
@@ -3339,9 +3338,9 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin
            enc_rval.failed_type->name, enc_rval.encoded);
      return -1;
   }
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_PCCH_Message, (void*)&pcch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_PCCH_Message, (void*)&pcch_msg);
+  }
 
   return((enc_rval.encoded+7)/8);
 }
@@ -3504,9 +3503,9 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
   }
 
   UECapability.UE_EUTRA_Capability = UE_EUTRA_Capability;
-#ifdef XER_PRINT
-  xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability,
                                    NULL,
                                    (void*)UE_EUTRA_Capability,
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
index 3ad955928a758a97114f76b938e5831ac01e8a9e..20962f3ca159741224898017637a3400df005c90 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
@@ -382,9 +382,9 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
   ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list,&systemInfoValueTagSI);
 
 
-#ifdef XER_PRINT //generate xml files
-  xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
+  }
 
 
   enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB,
@@ -667,9 +667,9 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
   ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list,
                    sib3_NB_part);
 
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB,
                                    NULL,
                                    (void*)bcch_message,
@@ -887,9 +887,9 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
  rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = physicalConfigDedicated2_NB_IoT;
  rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13 = NULL;
 
-#ifdef XER_PRINT
- xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
-#endif
+ if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+    xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT);
+ }
  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
                                   NULL,
                                   (void*)&dl_ccch_msg_NB_IoT,
@@ -939,9 +939,9 @@ uint8_t do_SecurityModeCommand_NB_IoT(
     = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm;
 
 //only changed "asn_DEF_DL_DCCH_Message_NB"
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
                                    NULL,
                                    (void*)&dl_dcch_msg_NB_IoT,
@@ -1001,9 +1001,9 @@ uint8_t do_UECapabilityEnquiry_NB_IoT(
   //no ue_CapabilityRequest (list of RAT_Type)
 
 //only changed "asn_DEF_DL_DCCH_Message_NB"
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
                                    NULL,
                                    (void*)&dl_dcch_msg_NB_IoT,
@@ -1110,9 +1110,9 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT(
   }
 
   //changed only asn_DEF_DL_DCCH_Message_NB
-#ifdef XER_PRINT
-  xer_fprint(stdout,&asn_DEF_DL_DCCH_Message_NB,(void*)&dl_dcch_msg_NB_IoT);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout,&asn_DEF_DL_DCCH_Message_NB,(void*)&dl_dcch_msg_NB_IoT);
+  }
 
 //#if defined(ENABLE_ITTI)
 //# if !defined(DISABLE_XER_SPRINT)...
@@ -1143,9 +1143,9 @@ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT(
   rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8;
 
   //Only change in "asn_DEF_DL_CCCH_Message_NB"
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
                                    NULL,
                                    (void*)&dl_ccch_msg_NB_IoT,
@@ -1214,9 +1214,9 @@ uint8_t do_RRCConnectionReject_NB_IoT(
 		  RRCConnectionReject_NB_r13_IEs__rrc_SuspendIndication_r13_true;
 
   //Only Modified "asn_DEF_DL_CCCH_Message_NB"
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
                                    NULL,
                                    (void*)&dl_ccch_msg_NB_IoT,
@@ -1355,9 +1355,9 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT(
 	               enc_rval.failed_type->name, enc_rval.encoded);
         }
 
-#ifdef XER_PRINT
-  xer_fprint(stdout,&asn_DEF_DL_CCCH_Message_NB,(void*)&dl_ccch_msg_NB_IoT);
-#endif
+        if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+           xer_fprint(stdout,&asn_DEF_DL_CCCH_Message_NB,(void*)&dl_ccch_msg_NB_IoT);
+        }
 
 #if defined(ENABLE_ITTI)
 # if !defined(DISABLE_XER_SPRINT)
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index 8f25cd62870baaffafdf085b2bf3f42cee55cc33..362306943d0934cb799c1dda360785a8347bcc62 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -99,10 +99,6 @@ int send_ue_information = 0;
 // for malloc_clear
 #include "PHY/defs_UE.h"
 
-//#define XER_PRINT
-
-
-
 extern void pdcp_config_set_security(
   const protocol_ctxt_t* const  ctxt_pP,
   pdcp_t         * const pdcp_pP,
@@ -733,9 +729,9 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co
                          (uint8_t*)Srb_info->Rx_buffer.Payload,
                          100,0,0);
 
-#ifdef XER_PRINT
-  xer_fprint(stdout,&asn_DEF_DL_CCCH_Message,(void*)dl_ccch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout,&asn_DEF_DL_CCCH_Message,(void*)dl_ccch_msg);
+  }
 
 #if defined(ENABLE_ITTI)
 # if defined(DISABLE_ITTI_XER_PRINT)
@@ -1931,9 +1927,9 @@ rrc_ue_process_securityModeCommand(
     AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
 		 enc_rval.failed_type->name, enc_rval.encoded);
     
-#ifdef XER_PRINT
-    xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
-#endif
+    if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+       xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
+    }
     
 #if defined(ENABLE_ITTI)
 # if !defined(DISABLE_XER_SPRINT)
@@ -2042,9 +2038,9 @@ rrc_ue_process_ueCapabilityEnquiry(
       AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
 		   enc_rval.failed_type->name, enc_rval.encoded);
       
-#ifdef XER_PRINT
-      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
-#endif
+      if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+         xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
+      }
       
 #if defined(ENABLE_ITTI)
 # if !defined(DISABLE_XER_SPRINT)
@@ -2429,9 +2425,9 @@ rrc_ue_decode_dcch(
               (uint8_t*)Buffer,
               RRC_BUF_SIZE,0,0);
 
-#ifdef XER_PRINT
-  xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)dl_dcch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)dl_dcch_msg);
+  }
 
 #if defined(ENABLE_ITTI)
 # if defined(DISABLE_ITTI_XER_PRINT)
@@ -4560,9 +4556,9 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB
       return -1;
     }
 
-#ifdef XER_PRINT
-    xer_fprint(stdout, &asn_DEF_MCCH_Message, (void*)mcch);
-#endif
+    if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+      xer_fprint(stdout, &asn_DEF_MCCH_Message, (void*)mcch);
+    }
 
     if (mcch->message.present == MCCH_MessageType_PR_c1) {
       LOG_D(RRC,"[UE %d] Found mcch message \n",
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index e34758843d08e199988ce18b457770e271570f21..cac49690afe8fe28497c21b8de046839d5d60303 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -100,7 +100,6 @@
 
 #include "SIMULATION/TOOLS/sim.h" // for taus
 
-//#define XER_PRINT
 
 extern RAN_CONTEXT_t RC;
 
@@ -6898,9 +6897,9 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
             PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
             DCCH,
             sdu_sizeP);
-#ifdef XER_PRINT
-      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
-#endif
+      if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+         xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
+      }
       // confirm with PDCP about the security mode for DCCH
       //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77);
       // continue the procedure
@@ -6932,9 +6931,9 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
             PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
             DCCH,
             sdu_sizeP);
-#ifdef XER_PRINT
-      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
-#endif
+      if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+         xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
+      }
       // cancel the security mode in PDCP
 
       // followup with the remaining procedure
@@ -6974,9 +6973,9 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
             PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
             DCCH,
             sdu_sizeP);
-#ifdef XER_PRINT
-      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
-#endif
+      if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+          xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
+      }
       LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
       if (ue_context_p->ue_context.UE_Capability) {
         LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti);
@@ -6993,9 +6992,9 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
                              ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
                              choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
                              array[0]->ueCapabilityRAT_Container.size, 0, 0);
-#ifdef XER_PRINT
-      xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability);
-#endif
+      if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+         xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability);
+      }
 
       if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
         LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n",
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c
index 60b3c55c79aa98ec0467c73eb47b005f24463b00..7d242286023985c1002562d25feb32040285603e 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c
@@ -467,43 +467,20 @@ rrc_pdcp_config_security(
                      &kRRCint);
 
 #if !defined(USRP_REC_PLAY)
-#define DEBUG_SECURITY 1
+  SET_LOG_DUMP(DEBUG_SECURITY) ;
 #endif
   
-#if defined (DEBUG_SECURITY)
-#undef msg
-#define msg printf
 
-  if (print_keys ==1 ) {
-    print_keys =0;
-    int i;
-    msg("\nKeNB:");
-
-    for(i = 0; i < 32; i++) {
-      msg("%02x", ue_context_pP->ue_context.kenb[i]);
-    }
+  if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) {
+    if (print_keys ==1 ) {
+      print_keys =0;
 
-    msg("\n");
-
-    msg("\nKRRCenc:");
-
-    for(i = 0; i < 32; i++) {
-      msg("%02x", kRRCenc[i]);
+      LOG_DUMPMSG(RRC, DEBUG_SECURITY, ue_context_pP->ue_context.kenb, 32,"\nKeNB:" );
+      LOG_DUMPMSG(RRC, DEBUG_SECURITY, kRRCenc, 32,"\nKRRCenc:" );
+      LOG_DUMPMSG(RRC, DEBUG_SECURITY, kRRCint, 32,"\nKRRCint:" );
     }
-
-    msg("\n");
-
-    msg("\nKRRCint:");
-
-    for(i = 0; i < 32; i++) {
-      msg("%02x", kRRCint[i]);
-    }
-
-    msg("\n");
-
   }
 
-#endif //DEBUG_SECURITY
   key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES);
   h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
 
diff --git a/openair2/X2AP/x2ap_common.h b/openair2/X2AP/x2ap_common.h
index 1a4889f0f01699cb307b8e1c30b08351a1a4df36..d2ff3b40d1088522cc44546096e13d1fedfc60cf 100644
--- a/openair2/X2AP/x2ap_common.h
+++ b/openair2/X2AP/x2ap_common.h
@@ -57,7 +57,6 @@
 #define FALSE 0
 #endif
 
-extern int asn_debug;
 extern int asn1_xer_print;
 
 #if defined(ENB_MODE)
diff --git a/openair3/NAS/COMMON/UTIL/nas_log.c b/openair3/NAS/COMMON/UTIL/nas_log.c
deleted file mode 100644
index 6af90c4be871ab88e0a698c0926efd43f9f87b09..0000000000000000000000000000000000000000
--- a/openair3/NAS/COMMON/UTIL/nas_log.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*****************************************************************************
-Source    nas_log.c
-
-Version   0.1
-
-Date    2012/02/28
-
-Product   NAS stack
-
-Subsystem Utilities
-
-Author    Frederic Maurel
-
-Description Usefull logging functions
-
-*****************************************************************************/
-
-#include "nas_log.h"
-#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
-int nas_log_func_indent;
-#else
-#include <stdio.h>  // stderr, sprintf, fprintf, vfprintf
-#include <stdarg.h> // va_list, va_start, va_end
-#include <string.h> // strlen
-
-/****************************************************************************/
-/****************  E X T E R N A L    D E F I N I T I O N S  ****************/
-/****************************************************************************/
-
-/* ANSI escape codes for colored display */
-#define LOG_BLACK "\033[30m"
-#define LOG_RED   "\033[31m"
-#define LOG_GREEN "\033[32m"
-#define LOG_YELLOW  "\033[33m"
-#define LOG_BLUE  "\033[34m"
-#define LOG_MAGENTA "\033[35m"
-#define LOG_CYAN  "\033[36m"
-#define LOG_WHITE "\033[37m"
-#define LOG_END   "\033[0m"
-#define LOG_AUTO  LOG_END
-
-/****************************************************************************/
-/*******************  L O C A L    D E F I N I T I O N S  *******************/
-/****************************************************************************/
-
-/* ------------------------
- * Internal logging context
- * ------------------------
- *  Internal logging context consists on:
- *      - The file name and the line number from where the data have been
- *        logged. These information are gathered into a string that will
- *        be displayed as a prefix of the logging trace with the format
- *        filename[line]
- *      - The severity level filter
- *      - The indentation level to convey FUNC logging traces
- *      - The data definition of each logging trace level: name and mask
- *        (the mask is used against the severity level filter to enable
- *        or disable specific logging traces)
- */
-typedef struct {
-#define LOG_PREFIX_SIZE 118
-  char prefix[LOG_PREFIX_SIZE];
-  unsigned char filter;
-  int indent;
-  const struct {
-    char* name;
-    unsigned char mask;
-    char* color;
-  } level[];
-} log_context_t;
-
-/*
- * Definition of the logging context
- */
-static log_context_t _log_context = {
-  "",   /* prefix */
-  0x00, /* filter */
-  0,    /* indent */
-  {
-    { "DEBUG",  NAS_LOG_DEBUG,          LOG_GREEN },  /* DEBUG  */
-    { "INFO", NAS_LOG_INFO,         LOG_AUTO  },  /* INFO   */
-    { "WARNING",  NAS_LOG_WARNING,  LOG_BLUE  },  /* WARNING  */
-    { "ERROR",  NAS_LOG_ERROR,          LOG_RED   },  /* ERROR  */
-    { "",   NAS_LOG_FUNC,         LOG_AUTO  },  /* FUNC_IN  */
-    { "",   NAS_LOG_FUNC,         LOG_AUTO  },  /* FUNC_OUT */
-  }   /* level[]  */
-};
-
-/* Maximum number of bytes into a line of dump logging data */
-#define LOG_DUMP_LINE_SIZE  16
-
-/****************************************************************************/
-/******************  E X P O R T E D    F U N C T I O N S  ******************/
-/****************************************************************************/
-
-/****************************************************************************
- **                                                                        **
- ** Name:  log_init()                                                **
- **                                                                        **
- ** Description: Initializes internal logging data                         **
- **                                                                        **
- ** Inputs:  filter:  Value of the severity level that will be   **
- **       used as a filter to enable or disable      **
- **       specific logging traces                    **
- **      Others:  None                                       **
- **                                                                        **
- ** Outputs:   Return:  None                                       **
- **      Others:  None                                       **
- **                                                                        **
- ***************************************************************************/
-void nas_log_init(char filter)
-{
-  _log_context.filter = filter;
-}
-
-/****************************************************************************
- **                                                                        **
- ** Name:  log_data()                                                **
- **                                                                        **
- ** Description: Defines internal logging data                             **
- **                                                                        **
- ** Inputs:  filename:  Name of the file from where the data have  **
- **         been logged                                **
- **      line:    Number of the line in the file             **
- **      Others:  None                                       **
- **                                                                        **
- ** Outputs:   Return:  None                                       **
- **      Others:  None                                       **
- **                                                                        **
- ***************************************************************************/
-void log_data(const char* filename, int line)
-{
-  int len = strlen(filename) + 2 + 1; //2:[], 1:/0
-  if (line > 9999)     len+=5;
-  else if (line > 999) len+=4;
-  else if (line > 99)  len+=3;
-  else if (line > 9)   len+=2;
-  else                 len+=1;
-  if (len > LOG_PREFIX_SIZE) {
-	snprintf(_log_context.prefix, LOG_PREFIX_SIZE, "%s:%d", &filename[len - LOG_PREFIX_SIZE], line);
-  } else {
-    snprintf(_log_context.prefix, LOG_PREFIX_SIZE, "%s:%d", filename, line);
-  }
-}
-
-/****************************************************************************
- **                                                                        **
- ** Name:  log_trace()                                               **
- **                                                                        **
- ** Description: Displays logging data                                     **
- **                                                                        **
- ** Inputs:  severity:  Severity level of the logging data         **
- **      data:    Formated logging data to display           **
- **      Others:  None                                       **
- **                                                                        **
- ** Outputs:   Return:  None                                       **
- **      Others:  None                                       **
- **                                                                        **
- ***************************************************************************/
-void log_trace(log_severity_t severity, const char* data, ...)
-{
-  int i;
-
-  /* Sanity check */
-  if (severity > LOG_SEVERITY_MAX) return;
-
-  /* Display only authorized logging traces */
-  if (_log_context.level[severity].mask & _log_context.filter) {
-    va_list argp;
-
-    /*
-     * First, display internal logging data (logging trace prefix: file
-     * name and line number from where the data have been logged) and
-     * the severity level.
-     */
-    fprintf(stderr, "%s%-120.118s%-10s", _log_context.level[severity].color,
-            _log_context.prefix, _log_context.level[severity].name);
-    {
-      /* Next, perform indentation for FUNC logging trace */
-      if (severity == FUNC_OUT) {
-        _log_context.indent--;
-      }
-
-      for (i=0; i<_log_context.indent; i++) {
-        fprintf(stderr, "  ");
-      }
-
-      if (severity == FUNC_IN) {
-        _log_context.indent++;
-      }
-    }
-
-    /* Finally, display logging data */
-    va_start(argp, data);
-    vfprintf(stderr, data, argp);
-
-    /* Terminate with line feed character */
-    fprintf(stderr, "%s\n", LOG_END);
-
-    va_end(argp);
-  }
-}
-
-/****************************************************************************
- **                                                                        **
- ** Name:  log_dump()                                                **
- **                                                                        **
- ** Description: Dump logging data                                         **
- **                                                                        **
- ** Inputs:  data:    Logging data to dump                       **
- **      len:   Number of bytes to be dumped               **
- **      Others:  None                                       **
- **                                                                        **
- ** Outputs:   Return:  None                                       **
- **      Others:  None                                       **
- **                                                                        **
- ***************************************************************************/
-void log_dump(const char* data, int len)
-{
-  int i;
-
-  /* Display only authorized logging traces */
-  if ( (len > 0) && (NAS_LOG_HEX & _log_context.filter) ) {
-    int bytes = 0;
-
-    fprintf(stderr, "\n\t");
-
-    for (i=0; i < len; i++) {
-      fprintf(stderr, "%.2hx ", (const unsigned char) data[i]);
-
-      /* Add new line when the number of displayed bytes exceeds
-       * the line's size */
-      if ( ++bytes > (LOG_DUMP_LINE_SIZE - 1) ) {
-        bytes = 0;
-        fprintf(stderr, "\n\t");
-      }
-    }
-
-    if (bytes % LOG_DUMP_LINE_SIZE) {
-      fprintf(stderr, "\n");
-    }
-
-    fprintf(stderr, "\n");
-    fflush(stderr);
-  }
-}
-
-/****************************************************************************/
-/*********************  L O C A L    F U N C T I O N S  *********************/
-/****************************************************************************/
-#endif
-
diff --git a/openair3/NAS/COMMON/UTIL/nas_log.h b/openair3/NAS/COMMON/UTIL/nas_log.h
index c36e0795c7a141b1115d359773b376c7f86c5ec7..b41e34c51be03fe99aeeccfc104a580337e3e4a8 100644
--- a/openair3/NAS/COMMON/UTIL/nas_log.h
+++ b/openair3/NAS/COMMON/UTIL/nas_log.h
@@ -95,7 +95,7 @@ typedef enum {
 /******************  E X P O R T E D    F U N C T I O N S  ******************/
 /****************************************************************************/
 
-#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
+#ifdef LOG_E
 # define LOG_TRACE(s, x, args...)                               \
 do {                                                            \
     switch (s) {                                                \
@@ -106,54 +106,21 @@ do {                                                            \
     }                                                           \
 } while (0)
 
-# define LOG_DUMP(dATA, lEN)                                                    \
-do {                                                                            \
-    char buffer[3*lEN + 1];                                                     \
-    int i;                                                                      \
-    for (i = 0; i < lEN; i++)                                                   \
-        sprintf (&buffer[3*i], "%02x ", dATA[i]);                               \
-    LOG_D(NAS, " Dump %d: %s\n", lEN, buffer);                                  \
-} while (0)
-
-# define LOG_FUNC_IN                                                            \
-do {                                                                            \
-    LOG_D(NAS, " %s:%d %*sEntering %s()\n", __FILE__, __LINE__, nas_log_func_indent, "", __FUNCTION__);   \
-    nas_log_func_indent += 2;                                                   \
-} while (0)
-
-# define LOG_FUNC_OUT                                                           \
-do {                                                                            \
-    nas_log_func_indent -= 2;                                                   \
-    LOG_D(NAS, " %s:%d %*sLeaving %s()\n", __FILE__, __LINE__, nas_log_func_indent, "", __FUNCTION__);    \
-} while (0)
-
-# define LOG_FUNC_RETURN(rETURNcODE)                                            \
-do {                                                                            \
-    nas_log_func_indent -= 2;                                                   \
-    LOG_D(NAS, " %s:%d %*sLeaving %s(rc = %ld)\n", __FILE__, __LINE__, nas_log_func_indent, "",           \
-          __FUNCTION__, (long) (rETURNcODE));                                     \
-    return (rETURNcODE);                                                        \
-} while (0)
+# define LOG_DUMP(dATA, lEN)   LOG_DUMPMSG(NAS, DEBUG_NAS,dATA, lEN, " Dump %d:\n", lEN)                                                 
+# define LOG_FUNC_IN  LOG_ENTER(NAS)
+# define LOG_FUNC_OUT  LOG_END(NAS)
+# define LOG_FUNC_RETURN(rETURNcODE) LOG_RETURN(NAS,rETURNcODE)
 
 extern int nas_log_func_indent;
 
 #else
-# define LOG_TRACE log_data(__FILE__, __LINE__); log_trace
-# define LOG_DUMP(a, b) log_dump((a),(b));
-
-# define LOG_FUNC_IN LOG_TRACE(FUNC_IN, "Entering %s()", __FUNCTION__)
-# define LOG_FUNC_OUT LOG_TRACE(FUNC_OUT, "Leaving %s()", __FUNCTION__)
-# define LOG_FUNC_RETURN(rETURNcODE)                                            \
-do {                                                                           \
-    LOG_TRACE(FUNC_OUT, "Leaving %s(rc = %ld)", __FUNCTION__,                  \
-    (long) (rETURNcODE));                                                        \
-    return (rETURNcODE);                                                       \
-} while(0)
-
-void nas_log_init(char filter);
-void log_data(const char* filename, int line);
-void log_trace(log_severity_t severity, const char* data, ...);
-void log_dump(const char* data, int len);
+# define LOG_TRACE(s, x, args...)  
+# define LOG_DUMP(dATA, lEN)   LOG_DUMPMSG(NAS, LOG_DUMP_CHAR,dATA, lEN,  " Dump %d:\n", lEN)
+
+# define LOG_FUNC_IN 
+# define LOG_FUNC_OUT 
+# define LOG_FUNC_RETURN(rETURNcODE)  return  rETURNcODE                                  \
+
 #endif
 
 #endif /* __NAS_LOG_H__*/
diff --git a/openair3/NAS/UE/EMM/SAP/emm_fsm.c b/openair3/NAS/UE/EMM/SAP/emm_fsm.c
index d614b9ec7e42a5008c275251c1b6d229ab2b021c..5a715727ad17f3e091b7ca04a01eee113d2ccc59 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_fsm.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_fsm.c
@@ -208,8 +208,7 @@ emm_fsm_state_t emm_fsm_initialize()
 {
   LOG_FUNC_IN;
 
-  LOG_FUNC_OUT;
-  return EMM_NULL;
+  LOG_FUNC_RETURN(EMM_NULL);
 }
 
 /****************************************************************************
diff --git a/openair3/S1AP/s1ap_common.c b/openair3/S1AP/s1ap_common.c
index 7c4f970af2f18d61e626c4a7d8f70d607a8d663c..d31c6e58390917b82c12b836fddd40c0ecf286a6 100644
--- a/openair3/S1AP/s1ap_common.c
+++ b/openair3/S1AP/s1ap_common.c
@@ -32,26 +32,9 @@
 #include "s1ap_common.h"
 #include "S1AP_S1AP-PDU.h"
 
-int asn_debug = 0;
-int asn1_xer_print = 0;
-
-#if defined(EMIT_ASN_DEBUG_EXTERN)
-inline void ASN_DEBUG(const char *fmt, ...)
-{
-  if (asn_debug) {
-    int adi = asn_debug_indent;
-    va_list ap;
-    va_start(ap, fmt);
-    fprintf(stderr, "[ASN1]");
 
-    while(adi--) fprintf(stderr, " ");
+int asn1_xer_print = 0;
 
-    vfprintf(stderr, fmt, ap);
-    fprintf(stderr, "\n");
-    va_end(ap);
-  }
-}
-#endif
 
 void s1ap_handle_criticality(S1AP_Criticality_t criticality)
 {
diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h
index 8a2faa311f6e1e015d8c56654363f7e948a32811..94b3e43bc65b8789e330f25179381e0d2de4ba47 100644
--- a/openair3/S1AP/s1ap_common.h
+++ b/openair3/S1AP/s1ap_common.h
@@ -31,13 +31,16 @@
 #ifndef S1AP_COMMON_H_
 #define S1AP_COMMON_H_
 
-/* Defined in asn_internal.h */
-// extern int asn_debug_indent;
-extern int asn_debug;
 
-#if defined(EMIT_ASN_DEBUG_EXTERN)
-inline void ASN_DEBUG(const char *fmt, ...);
+#include "common/utils/LOG/log.h"
+/* replace ASN_DEBUG defined in asn_internal.h by oai tracing system
+   Would be cleaner to modify asn_internal.h but it seems to come
+   from non oai source, with BSD license, so prefer to do that here..
+*/
+#ifdef ASN_DEBUG
+# undef ASN_DEBUG
 #endif
+#define ASN_DEBUG( x... )  LOG_I(ASN, x)
 
 #include "S1AP_ProtocolIE-Field.h"
 #include "S1AP_S1AP-PDU.h"
diff --git a/openair3/UTILS/log.c b/openair3/UTILS/log.c
deleted file mode 100644
index 5ddebd415c7e83f79248c7cbae5023641b5b84fe..0000000000000000000000000000000000000000
--- a/openair3/UTILS/log.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "log.h"
-
-/* mme log */
-int log_enabled = 0;
-
-int log_init(const mme_config_t *mme_config_p,
-             log_specific_init_t specific_init)
-{
-  if (mme_config_p->verbosity_level == 1) {
-    log_enabled = 1;
-  } else if (mme_config_p->verbosity_level == 2) {
-    log_enabled = 1;
-  } else {
-    log_enabled = 0;
-  }
-
-  return specific_init(mme_config_p->verbosity_level);
-}
diff --git a/openair3/UTILS/log.h b/openair3/UTILS/log.h
deleted file mode 100644
index 7b712df755437a9048c7204618ae5d4832c49f29..0000000000000000000000000000000000000000
--- a/openair3/UTILS/log.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include "mme_config.h"
-
-#ifndef LOG_H_
-#define LOG_H_
-
-/* asn1c debug */
-extern int asn_debug;
-extern int asn1_xer_print;
-extern int fd_g_debug_lvl;
-
-typedef int (*log_specific_init_t)(int log_level);
-
-int log_init(const mme_config_t *mme_config,
-             log_specific_init_t specific_init);
-
-#endif /* LOG_H_ */
diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c
index 4a790b88063dcb195c4afcf05ef4e63dfee77260..f8230928ddf9a5f4948de1abcc07b26fa2bcd840 100644
--- a/targets/COMMON/create_tasks.c
+++ b/targets/COMMON/create_tasks.c
@@ -22,7 +22,7 @@
 #if defined(ENABLE_ITTI)
 # include "intertask_interface.h"
 # include "create_tasks.h"
-# include "log.h"
+# include "common/utils/LOG/log.h"
 
 # ifdef OPENAIR2
 #   if defined(ENABLE_USE_MME)
diff --git a/targets/COMMON/create_tasks_ue.c b/targets/COMMON/create_tasks_ue.c
index db531b0e9ddd73294530a337909d04c8878039fd..20b5979f31ee1c5829aee774739c4095afe50a49 100644
--- a/targets/COMMON/create_tasks_ue.c
+++ b/targets/COMMON/create_tasks_ue.c
@@ -22,7 +22,7 @@
 #if defined(ENABLE_ITTI)
 # include "intertask_interface.h"
 # include "create_tasks.h"
-# include "log.h"
+# include "common/utils/LOG/log.h"
 
 # ifdef OPENAIR2
 #   if defined(ENABLE_USE_MME)
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 2f8209f2d311ab5214952e670f4d6c4c19335b51..a1f26de5dc177211dc3a166d7e713e7b6fbd3bb0 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -192,7 +192,7 @@
 }
 
 #define CONFIG_HLP_FLOG          "Enable online log \n"
-#define CONFIG_HLP_LOGL          "Set the global log level, valide options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n"
+#define CONFIG_HLP_LOGL          "Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
 #define CONFIG_HLP_TELN          "Start embedded telnet server \n"
 /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 /*                                            command line parameters for LOG utility                                                                                        */
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index bf0abf15070ca472f742871d1ab71a88584c5b41..57b1dfb105805ecb2e30f8c279e7e7adcd16e7d6 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -830,21 +830,6 @@ int main( int argc, char **argv )
   //randominit (0);
   set_taus_seed (0);
 
-
-    set_log(HW,      OAILOG_DEBUG );
-    set_log(PHY,     OAILOG_INFO  );
-    set_log(MAC,     OAILOG_INFO  );
-    set_log(RLC,     OAILOG_INFO  );
-    set_log(PDCP,    OAILOG_INFO  );
-    set_log(OTG,     OAILOG_INFO  );
-    set_log(RRC,     OAILOG_INFO  );
-#if defined(ENABLE_ITTI)
-    set_log(SIM,     OAILOG_INFO );
-# if defined(ENABLE_USE_MME)
-    set_log(NAS,     OAILOG_INFO  );
-# endif
-#endif
-
   cpuf=get_cpu_freq_GHz();
 
   pthread_cond_init(&sync_cond,NULL);