Как скопировать лог ошибки

Пошаговое руководство

1. Нужно открыть в браузере «инструменты разработчика». Сделать это можно двумя способами:
1.1 Нажать клавишу «F12»
1.2 Либо открыть меню браузера и выбрать «Дополнительные инструменты» — «Инструменты разработчика».

Способ 1.2 может отличаться в других браузерах. Для примера используется рекомендуемый для работы в ЛК ИМ браузер Google Chrome.

2. Далее, нужно перейти во вкладку «Network» и убедиться, что индикатор в левом верхнем углу открытой панели красного цвета.

Если серого цвета, то нужно нажать на него, чтобы запустить запись лога.

3. Обновите страницу нажав клавишу «F5».

4. Попытайтесь воспроизвести ошибку, не закрывая «Инструменты разработчика».

5. Нажмите на любое место в нижнем списке правой кнопкой мыши и выберите пункт «Save as HAR with content». 

5.1 После чего появится всплывающее окно с выбором места, куда нужно сохранить файл лога.

Подождите!

Не закрывайте страницу. Нейросеть пишет ответ. Он появится тут.

Этот ответ написан нейросетью.

Искуственный интеллект во многом преуспевает, но в некоторых областях может давать неточные ответы.
Если вам не понравился ответ, попробуйте задать его более развёрнуто и конкретно, используя точные параметры.

Ответ нейросети:

Каждый браузер располагает своими средствами для отслеживания ошибок, которые могут возникать при работе с веб-сайтом. Такими ошибками могут быть например: JavaScript ошибки, сбои при загрузке ресурсов, проблемы с сетевым соединением и прочее. Просмотр логов браузера может помочь разработчику в определении причины возникновения ошибки и её исправлении.

Для просмотра логов ошибок в Google Chrome необходимо выполнить следующие действия:

1. Откройте браузер Google Chrome.
2. Нажмите на три точки, находящиеся в правом верхнем углу окна браузера, откройте меню инструментов и выберите пункт «More tools» («Дополнительные инструменты»).
3. В открывшемся меню выберите пункт «Developer tools» («Инструменты разработчика»).
4. В открывшемся окне инструментов разработчика выберите вкладку «Console» («Консоль»).
5. Чтобы просмотреть лог ошибок, вам необходимо выбрать вкладку «Errors» («Ошибки»). Здесь вы можете увидеть все ошибки, возникшие в процессе работы с сайтом.

В Mozilla Firefox посмотреть логи ошибок можно следующим образом:

1. Откройте браузер Мозилла Фаерфокс.
2. Нажмите на три полоски, находящиеся в правом верхнем углу окна браузера.
3. В открывшемся меню выберите пункт «Developer» («Разработчик»).
4. В открывшемся меню выберите пункт «Web Console» («Веб-консоль»).
5. Чтобы просмотреть логи ошибок, вам необходимо выбрать вкладку «Errors» («Ошибки»).

В браузере Safari просмотр логов ошибок осуществляется следующим образом:

1. Откройте браузер Safari.
2. Нажмите на пункт меню «Develop» («Разработка»).
3. Выберите пункт «Show Error Console» («Показать консоль ошибок»).
4. Чтобы просмотреть лог ошибок, вам необходимо выбрать вкладку «Errors» («Ошибки»).

Если вы используете браузер Opera, то для просмотра логов ошибок необходимо выполнить следующие действия:

1. Откройте браузер Opera.
2. Нажмите на иконку «Menu» («Меню»), расположенную в верхнем левом углу окна браузера.
3. Выберите пункт «Developer» («Разработчик»).
4. В открывшемся меню выберите пункт «Developer Tools» («Инструменты разработчика»).
5. В открывшемся окне инструментов разработчика выберите вкладку «Console» («Консоль»).
6. Чтобы просмотреть логи ошибок, вам необходимо выбрать вкладку «Errors» («Ошибки»).

Все современные браузеры оснащены средствами для просмотра логов ошибок, которые помогают разработчикам и пользователям сайтов быстрее находить и исправлять ошибки. Благодаря этому процесс разработки и поддержки сайтов становится более эффективным и продуктивным.

⚠️Зарепортить пост!

Довольно часто программы на Windows вылетают с ошибками. Обычно появляется диалоговое окно с коротким объяснением и кодом. Вот только выделить и скопировать этот текст стандартными методами не получается, а руками забивать ошибку в поисковик не хочется. В этом случае на помощь приходит бесплатная программа Textify.

Как скопировать текст ошибки в Windows 1

Программа не требует установки. Запустите её, настройте параметры запуска и вперёд. По умолчанию это будет “Shift” + “Средняя кнопка мыши (Колесо)”.

Теперь откройте диалоговое окно с ошибкой и нажмите выбранные кнопки запуска. Теперь текст можно скопировать.

Как скопировать текст ошибки в Windows 2

На видео это подробно показано:

Textify.zip (78.7 kB)

Как отправить логи браузера в поддержку

Специалист решит проблему с порталом, если вы покажете ему скриншоты и запишете, что происходит внутри браузера. Это делается легко и вот инструкция для основных браузеров.

Очистите кэш и куки в браузере, чтобы ничего не мешало определить ошибку. Затем откройте консоль разработчика. Вот как сделать это в основных браузерах.

Клавиши на MacOS:

Cmd + Alt + I

Клавиши в Windows:

Ctrl + Alt + I или F12

В настройках

Для Google Chrome и Яндекс.Браузера: Меню → Дополнительные инструменты → Инструменты разработчика. Выберите вкладку Network(Сеть).

Mozilla. Меню → Веб-разработка → Сеть

Internet Explorer. Меню → Средства разработчика → вкладка Сеть → Нажать на иконку зеленого треугольника.

Обновите страницу(используйте клавиши Shift + F5 — обновляет страницу из источника) и сделайте в браузере то же, что привело к ошибке.

  1. С каждым кликом делайте скриншот всего браузера: на нем должно быть видно как само окно, так и консоль разработчика, где пишутся логи.

Как отправить логи браузера в поддержку

Как отправить логи браузера в поддержку

Как сделать скриншот

  1. Как только появится ошибка, кликните правой кнопкой мыши по любой строке консоли и выберите:

— в Google Chrome и Яндекс.Браузере: Save as(Сохранить как),

— в Mozilla: Сохранить все как HAR,

— в Internet Explorer: нажать на иконку дискеты и сохранить файл на компьютер.

Сохраните файл с логами браузера, скопируйте URL-страницы(адрес) и пришлите специалисту поддержки.

URL-страницы

Does anyone know of a way to save the console.log output in Chrome to a file? Or how to copy the text out of the console?

Say you are running a few hours of functional tests and you’ve got thousands of lines of console.log output in Chrome. How do you save it or export it?

asked Oct 2, 2011 at 15:02

eeejay's user avatar

1

Good news

Chrome dev tools now allows you to save the console output to a file natively

  1. Open the console
  2. Right-click
  3. Select «save as..»

save console to file

Chrome Developer instructions here.

Community's user avatar

answered Jun 25, 2015 at 20:00

adardesign's user avatar

adardesignadardesign

34.1k15 gold badges62 silver badges84 bronze badges

11

I needed to do the same thing and this is the solution I found:

  1. Enable logging from the command line using the flags:

    --enable-logging --v=1

This logs everything Chrome does internally, but it also logs all the console.log() messages as well. The log file is called chrome_debug.log and is located in the User Data Directory which can be overridden by supplying --user-data-dir=PATH (more info here).

  1. Filter the log file you get for lines with CONSOLE(\d+).

Note that console logs do not appear with --incognito.

Amir's user avatar

Amir

9,1015 gold badges34 silver badges46 bronze badges

answered Apr 9, 2012 at 1:43

Waleed Abdulla's user avatar

Waleed AbdullaWaleed Abdulla

1,8731 gold badge14 silver badges20 bronze badges

20

I have found a great and easy way for this.

  1. In the console — right click on the console logged object

  2. Click on ‘Store as global variable’

  3. See the name of the new variable — e.g. it is variableName1

  4. Type in the console: JSON.stringify(variableName1)

  5. Copy the variable string content: e.g. {«a»:1,»b»:2,»c»:3}

enter image description here

  1. Go to some JSON online editor:
    e.g. https://jsoneditoronline.org/

enter image description here

answered Mar 20, 2018 at 13:03

Combine's user avatar

CombineCombine

3,9042 gold badges27 silver badges30 bronze badges

2

There is an open-source javascript plugin that does just that, but for any browser — debugout.js

Debugout.js records and save console.logs so your application can access them. Full disclosure, I wrote it. It formats different types appropriately, can handle nested objects and arrays, and can optionally put a timestamp next to each log. You can also toggle live-logging in one place, and without having to remove all your logging statements.

answered Jun 17, 2014 at 17:49

inorganik's user avatar

inorganikinorganik

24.3k17 gold badges90 silver badges115 bronze badges

4

For better log file (without the Chrome-debug nonsense) use:

--enable-logging --log-level=0

instead of
--v=1 which is just too much info.

It will still provide the errors and warnings like you would typically see in the Chrome console.

update May 18, 2020: Actually, I think this is no longer true. I couldn’t find the console messages within whatever this logging level is.

answered Apr 10, 2017 at 23:24

JohnP2's user avatar

JohnP2JohnP2

1,89919 silver badges17 bronze badges

2

For Google Chrome Version 84.0.4147.105 and higher,

just right click and click ‘Save as’ and ‘Save’

then, txt file will be saved

enter image description here

answered Aug 2, 2020 at 23:32

Edsel Ayala's user avatar

Edsel AyalaEdsel Ayala

2194 silver badges7 bronze badges

1

This may or may not be helpful but on Windows you can read the console log using Event Tracing for Windows

http://msdn.microsoft.com/en-us/library/ms751538.aspx

Our integration tests are run in .NET so I use this method to add the console log to our test output. I’ve made a sample console project to demonstrate here: https://github.com/jkells/chrome-trace

—enable-logging —v=1 doesn’t seem to work on the latest version of Chrome.

answered Oct 4, 2013 at 5:21

Jared Kells's user avatar

Jared KellsJared Kells

6,7814 gold badges38 silver badges43 bronze badges

There is another open-source tool which allows you to save all console.log output in a file on your server — JS LogFlush (plug!).

JS LogFlush is an integrated JavaScript logging solution which include:

  • cross-browser UI-less replacement of console.log — on client side.
  • log storage system — on server side.

Demo

answered Sep 16, 2014 at 14:55

hindmost's user avatar

hindmosthindmost

7,1353 gold badges27 silver badges39 bronze badges

If you’re running an Apache server on your localhost (don’t do this on a production server), you can also post the results to a script instead of writing it to console.

So instead of console.log, you can write:

JSONP('http://localhost/save.php', {fn: 'filename.txt', data: json});

Then save.php can do this

<?php

 $fn = $_REQUEST['fn'];
 $data = $_REQUEST['data'];

 file_put_contents("path/$fn", $data);

answered Jul 17, 2015 at 13:27

supersan's user avatar

supersansupersan

5,7063 gold badges45 silver badges64 bronze badges

4

  1. Right-click directly on the logged value you want to copy
  2. In the right-click menu, select «Store as global variable»
  3. You’ll see the value saved as something like «temp1» on the next line in the console
  4. In the console, type copy(temp1) and hit return (replace temp1 with the variable name from the previous step). Now the logged value is copied to your clipboard.
  5. Paste the values to wherever you want

This is especially good as an approach if you don’t want to mess with changing flags/settings in Chrome and don’t want to deal with JSON stringifying and parsing etc.

Update: I just found this explanation of what I suggested with images that’s easier to follow https://scottwhittaker.net/chrome-devtools/2016/02/29/chrome-devtools-copy-object.html

answered Apr 27, 2021 at 22:08

epan's user avatar

epanepan

3723 silver badges14 bronze badges

0

These days it’s very easy — right click any item displayed in the console log and select save as and save the whole log output to a file on your computer.

answered Feb 21, 2019 at 18:27

brianlmerritt's user avatar

brianlmerrittbrianlmerritt

2,6441 gold badge34 silver badges39 bronze badges

On Linux (at least) you can set CHROME_LOG_FILE in the environment to have chrome write a log of the Console activity to the named file each time it runs. The log is overwritten every time chrome starts. This way, if you have an automated session that runs chrome, you don’t have a to change the way chrome is started, and the log is there after the session ends.

export CHROME_LOG_FILE=chrome.log

answered Feb 10, 2020 at 17:13

DrChandra's user avatar

DrChandraDrChandra

1811 silver badge6 bronze badges

the other solutions in this thread weren’t working on my mac. Here’s a logger that saves a string representation intermittently using ajax. use it with console.save instead of console.log

var logFileString="";
var maxLogLength=1024*128;

console.save=function(){
  var logArgs={};

  for(var i=0; i<arguments.length; i++) logArgs['arg'+i]=arguments[i];
  console.log(logArgs);

  // keep a string representation of every log
  logFileString+=JSON.stringify(logArgs,null,2)+'\n';

  // save the string representation when it gets big
  if(logFileString.length>maxLogLength){
    // send a copy in case race conditions change it mid-save
    saveLog(logFileString);
    logFileString="";
  }
};

depending on what you need, you can save that string or just console.log it and copy and paste. here’s an ajax for you in case you want to save it:

function saveLog(data){
  // do some ajax stuff with data.
  var xhttp = new XMLHttpRequest();

  xhttp.onreadystatechange = function(){
    if (this.readyState == 4 && this.status == 200) {}
  }

  xhttp.open("POST", 'saveLog.php', true);
  xhttp.send(data);
}

the saveLog.php should append the data to a log file somewhere. I didn’t need that part so I’m not including it here. :)

https://www.google.com/search?q=php+append+to+log

answered Mar 1, 2020 at 9:01

Symbolic's user avatar

SymbolicSymbolic

6935 silver badges10 bronze badges

This answer might seem specifically related, but specifically for Network Log, you can visit the following link.

The reason I’ve post this answer is because in my case, the console.log printed a long truncated text so I couldn’t get the value from the console. I solved by getting the api response I was printing directly from the network log.

chrome://net-export/

There you may see a similar windows to this, just press the Start Logging to Disk button and that’s it:

enter image description here

answered Apr 8, 2022 at 15:14

luiscla27's user avatar

luiscla27luiscla27

5,00139 silver badges49 bronze badges

Create a batch file using below command and save it as ChromeDebug.bat in your desktop.

start chrome --enable-logging --v=1

Close all other Chrome tabs and windows.
Double click ChromeDebug.bat file which will open Chrome and a command prompt with Chrome icon in taskbar.
All the web application logs will be stored in below path.
Run the below path in Run command to open chrome log file

%LocalAppData%\Google\Chrome\User Data\chrome_debug.log

answered Jul 7, 2022 at 19:46

Sunil Ram's user avatar

One approch is to convert results into string and convert that string data to blob and then to data url and make it downloadable using <a> tag and click()

// Convert string data to url
var results = { test1: 'result1', test2: 'result2' }
let blob = new Blob([JSON.stringify(results)], {type: 'text/plain'})
let url = URL.createObjectURL(blob)

// Create anchor tag
let downloadLink = document.createElement('a')
downloadLink.download = 'results.txt'
downloadLink.href = url

// Click to download file
downloadLink.click()

answered May 22 at 4:24

Alok's user avatar

AlokAlok

7,7828 gold badges55 silver badges103 bronze badges

Понравилась статья? Поделить с друзьями:

Интересное по теме:

  • Как скинуть ошибку сервис на газель некст
  • Как скинуть ошибку чек энджин
  • Как скинуть ошибку подушки безопасности на приоре
  • Как скинуть ошибку на туареге
  • Как снизить ошибку титрования

  • Добавить комментарий

    ;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: