How to prevent logger from writing to stderr?

I have a function to setup a logger.


def setup_logger(logger_name, log_file=None, stream=None, level=logging.DEBUG):     '''     Setup a Logger     '''     logger = logging.getLogger(logger_name)     logger.handlers = []      formatter = logging.Formatter('[%(asctime)s] %(levelname)s: %(message)s',                                   datefmt='%Y-%m-%d %H:%M:%S')      if log_file:         fileHandler = logging.FileHandler(log_file, mode='w')         fileHandler.setFormatter(formatter)         fileHandler.setLevel(level)         logger.addHandler(fileHandler)      if stream:         streamHandler = logging.StreamHandler()         streamHandler.setFormatter(formatter)         streamHandler.setLevel(level)         logger.addHandler(streamHandler)      return logger 

Using above, say I define the logger with following commands,

my_logger = setup_logger('my_logger', '/tmp/my_logger.log') my_logger.info('This should not appear on stderr') 

Then the output should only go to the log file, and not the stdout or stderr. However, I always get the output on stderr as well, which messes with a progressbar that I intend to use to track progress of another task. Any idea how I could get it to not write output to the stderr?

Thank you.

Search Engine Optimization. The Starter Guide for $2

This document first began as an effort to help teams within Google, but we thought it’d be just as useful to webmasters that are new to the topic of search engine optimization and wish to improve their sites’ interaction with both users and search engines. Although this guide won’t tell you any secrets that’ll automatically rank your site first for queries in Google (sorry!), following the best practices outlined below will make it easier for search engines to crawl, index and understand your content. Search engine optimization is often about making small modifications to parts of your website. When viewed individually, these changes might seem like incremental improvements, but when combined with other optimizations, they could have a noticeable impact on your site’s user experience and performance in organic search results. You’re likely already familiar with many of the topics in this guide, because they’re essential ingredients for any web page, but you may not be making the most out of them. Even though this guide’s title contains the words “search engine”, we’d like to say that you should base your optimization decisions first and foremost on what’s best for the visitors of your site. They’re the main consumers of your content and are using search engines to find your work. Focusing too hard on specific tweaks to gain ranking in the organic results of search engines may not deliver the desired results. Search engine optimization is about putting your site’s best foot forward when it comes to visibility in search engines, but your ultimate consumers are your users, not search engines. Your site may be smaller or larger than our example site and offer vastly different content, but the optimization topics we discuss below should apply to sites of all sizes and types. We hope our guide gives you some fresh ideas on how to improve your website, and we’d love to hear your questions, feedback, and success stories in the Google Webmaster Help Forum.

by: oforce500
Created: —
Category: Onsite SEO & Research
Viewed: 90


Error: package android.util does not exist

I am trying to compile my java code, so I first convert it to .class, then to .dex and finally to smali, this has always worked, except for now as I am using the method Log.e() instead of System.out.println() to log some errors; I am unable to convert the .java file to .class.

This is the command I launch to get the .class file:

$ javac helloworld.java

Even though I’ve imported the library import android.util.Log; I get the following Error:

sources/com/canal/android/external/CplusJni.java:9: error: package android.util does not exist import android.util.Log; ^

sources/com/canal/android/external/CplusJni.java:25: error: cannot find symbol Log.e(“—————————————————————————–“); ^ symbol: variable Log location: class CplusJni

sources/com/canal/android/external/CplusJni.java:26: error: cannot find symbol Log.e(“cplusPKCS12Cert: “,cplusPKCS12Cert); ^ symbol: variable Log location: class CplusJni

sources/com/canal/android/external/CplusJni.java:27: error: cannot find symbol Log.e(“—————————————————————————–“); ^ symbol: variable Log location: class CplusJni

sources/com/canal/android/external/CplusJni.java:35: error: cannot find symbol Log.e(“—————————————————————————–“); ^ symbol: variable Log location: class CplusJni

sources/com/canal/android/external/CplusJni.java:36: error: cannot find symbol Log.e(“sSLSocketFactory: “,sSLSocketFactory); ^ symbol: variable Log location: class CplusJni

sources/com/canal/android/external/CplusJni.java:37: error: cannot find symbol Log.e(“—————————————————————————–“); ^ symbol: variable Log location: class CplusJni 7 errors

I would appreciate some help with this!

Make SEO Package And higher on the search engine rankings for $45

After many attempts I have finally found the answer to what needs to happen to help your website rank up, so make sure you don’t miss out! You are now on a gig that will provide you with a Pro1 SEO Package that is designed to work across all websites. This package will lift you higher on the search engine rankings, which in turn will provide you with FREE organic traffic to your site via highly targeted visitors. Using my tried and tested strategy I can provide you with the following: – Increased website authority – Top-ranked website based on keywords – Manually built backlinks with only high PR site, using unique content – Google Penguin 3.0 and Panda 4.1 safe work – 100% White Hat, manual work only – Totally Unique articles – Flawless Approval rate – Do-follow backlinks – Only a Natural mix of anchored and non-anchored high PR backlinks – Full reports and Logins Please see the image attached to this gig to choose the correct plan for you. Any questions please message me. I’m more than happy to discuss things further.

by: seoplant07
Created: —
Category: Link Building
Viewed: 172


nginx multiple php instances with multiple domains including multiple moodle websites under domain [error]

I am running a nginx web server on CentOS 7. I use two php versions php 7.2 on port 9000 (for Moodle 3.6) and php 5.6 on 9001 (for Moodle 2.7).

For Moodle 2.6, there is one domain (lms.example.com) and in that domain few Moodle 2.7 websites are running (Eg: lms.example.com/undergraduate, lms.example.com/postgraduate etc.).

Moodle 3.6 runs fine without any problems. But Moodle 2.7 websites does not show properly. It does not show any images in the websites. Only the text are shown.

I tried setup one .conf file for each sub folder. but did not worked. ended as same.

default.conf is as follows;

map $  request_uri $  rot {     default /var/www/html/lms/;     "^~undergraduate" /var/www/html/lms/undergraduate/;     "^~postgraduate" /var/www/html/lms/postgraduate/; } server {     listen 80 default_server;     server_name lms.example.com;     root $  rot;     index index.html index.php;      location / {          try_files $  uri $  uri/  index.php =404;     }      location /dataroot/ {         internal;         alias /var/www/html/lms-data/$  rot-data;     }      location ~* \.php$   {         fastcgi_pass 127.0.0.1:9001;         include         fastcgi_params;         fastcgi_param   SCRIPT_FILENAME             $  document_root$  fastcgi_script_name;         fastcgi_param   SCRIPT_NAME        $  fastcgi_script_name;     } } 

log shows, 2019/06/17 20:46:28 [error] 9134#9134: *41 FastCGI sent in stderr: “PHP message: PHP Notice: Undefined variable: data in /path/to/moodle/website/cache/stores/file/lib.php on line 370” while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: lms.xxx.xxx, request: “GET /xxx/ HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9001”, host: “xxx.xxx.xxx”

Create Responsive Jot-form, Type-form, Survey-form and Google-Docs with FREE QR Code for $20

3… 2… 1… Action! Hey there! I will create a professional digital online survey form, jotform,typeform, registration form, contact form, info gathering, polls, quiz, customer Feedback / Satisfaction form, application form and lot more send them to other people. I will Create Google Slides. DOCX, XLSX, PDF, JPG, other documents, etc –> into –> Google forms, sheets, docs, slides. WHAT I NEED FROM YOU: 1. Provide me your document (Including all requirements) 2.Your mail id. 3. You have to create a JOT form account and send me credentials (login id + password) Please check: JOT FORMS: http://bit.ly/2HJdVGK WHAT WILL YOU GET: * A web link to send via email or share it on Facebook, Twitter, and other social networking sites to collect responses. * Provide you the form data file in Excel/CSV format once form completed. * If you need, I will give you the ownership of the form too. * Payment integration in jotforms. *Different Logics based jotforms *Custom design with CSS in jotform Silver Package: (Basic – 15$ (On Sale)) Jotform /Typeform/Google with 20 Questions+Formatting+5 A4 size Pages per gig (for other documents) Question Writing – Yes Custom Branding – Yes Advanced Survey -Yes Logi cQuestion – Yes Flow Design -Yes Number of Questions -20 Gold Package: (45$ ): Jotform /Typeform/Google with 40 Questions+Formatting+5 A4 size Pages per gig (for other documents) Question Writing – Yes Custom Branding – Yes Advanced Survey -Yes Logi cQuestion – Yes Flow Design -Yes Number of Questions -40 Platinum Package: (65$ ): Jotform /Typeform/Google with 70 Questions+Formatting+15 A4 size Pages per gig (for other documents) Question Writing – Yes Custom Branding – Yes Advanced Survey -Yes Logi cQuestion – Yes Flow Design -Yes Number of Questions -70 REASON TO CHOOSE ME: Super-fast deliveryUnlimited Revisions100% Job Satisfaction GuaranteedExtremely Affordable pricesCoding Expert Working with international clients for over 6 years Operate from Stuttgart Germany. Please do not hesitate to contact me for any type of custom orders. I will be excited to collaborate with you for a challenging project. Just Order Now – Sit back – Relax and let me do all the hard work for you!

by: snigchat
Created: —
Category: Question/Answer
Viewed: 146


Is there any way to customize the functionality/appearance of an HTML object tag?

I currently have a simple <object> tag used for displaying a PDF in the browser. Ideally, what I’d like to be able to do is add some additional buttons to the top bar, and maybe change the design (for example – swapping the default grey background with a white background).

I tried using some inline styling to test and it did nothing. I also noticed that the element selector in the dev console doesn’t even highlight the object. So I’m feeling pretty skeptical about it, but I couldn’t find anything about whether or not this is possible.

I know of PDF.js, but using the object tag is so much simpler than a whole new library and is almost enough functionality for it to be a perfect for my use. I don’t want to have to reinvent the wheel if it’s actually possible to tweak the style/buttons provided by default in the object tag.

Is there any way to customize the functionality/appearance of an HTML object tag?

I currently have a simple <object> tag used for displaying a PDF in the browser. Ideally, what I’d like to be able to do is add some additional buttons to the top bar, and maybe change the design (for example – swapping the default grey background with a white background).

I tried using some inline styling to test and it did nothing. I also noticed that the element selector in the dev console doesn’t even highlight the object. So I’m feeling pretty skeptical about it, but I couldn’t find anything about whether or not this is possible.

I know of PDF.js, but using the object tag is so much simpler than a whole new library and is almost enough functionality for it to be a perfect for my use. I don’t want to have to reinvent the wheel if it’s actually possible to tweak the style/buttons provided by default in the object tag.

Do 80 Niche Relevant Backlinks Low Obl Manual Blog Comments for $5

GREAT QUALITY WORK ALL APPROVED BACKLINKS I OFFER you in your niche relevant work NICHE relevant process is quite safe and secure for your site to get Rank on Google and another search engine. Niche relevant backlinks are more secure and more eventful in front of common backlinks and I will use only Relevant links as it is according to your niche or your keyword and delightfull accepting all kind of Niche (Except Porn or illegal sites). GIg FEATURES: UnCountable Keywords And URLs All Niche Are Accepted. 100% Authority Backlinks.100% White Hated SEO.100% Hand Made.No Follow BacklinksSatisfied Work.Guaranteed Ranking.Excel Sheet After Completion.24/7 SupportOn Time Delivery. Not Accepted: Adults, Gambling, Porn, Drugs Websites. Thanks…….MUBEEN213

by: mubeen213
Created: —
Category: Blog Comments
Viewed: 132


Hackerrank Python | Find the Runner-Up Score

I am trying to complete this hackerrank exercise. The goal is to receive two inputs n (array length) and A (an array of user input) and then print out the second largest value in the array. I came up with this idea and it works in my Google Colab Notebook but on hackerrank it tells me that it could not compile. What is going wrong?

import numpy as np  # read in user values n = int(input()) A = [int(x) for x in input().split()][:n] A = np.asarray(A)  # determine max value to remove it from the array max_value = np.max(A) index = np.argwhere(A == max_value) A_reduced = np.delete(A, index)  print(np.max(A_reduced))